1. Поиск говнокода

    Этот поиск практически ничего не может найти! Но вы всё-таки попытайтесь, вдруг повезет.

    Найдено: 384

  2. PHP / Говнокод #1509

    +154.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $res = & $mdb2->query ( " SELECT * FROM manage WHERE parsed = 0 AND timestamp = DATE_FORMAT(now(), '%Y-%m-%d'); ");
    while ( $row = $res->fetchRow ()) {
    …
    try {
    …
    } catch (Exception $e) {
    …
    }
    if (empty($e)) $res = & $mdb2->query ( «UPDATE `user_control`.`manage` SET `parsed` = 1 WHERE `manage`.`ti_uid` ='».$row['ti_uid']."' LIMIT 1; ");
    }

    $res

    random2, 10 Августа 2009

    Комментарии (0)
  3. SQL / Говнокод #1497

    −867.6

    1. 1
    SELECT SQL_CALC_FOUND_ROWS *,cached_login as login,cached_name as uname,comment_count as ccount FROM posts p WHERE exists (select * from tags tg, tegi_zapisi tx where tg.alt_title like 'post' and tg.id_tag=tx.id_tag and tx.id_post=p.id_post) and exists (select * from tags tg, tegi_zapisi tx where tg.alt_title like 'opentomsk' and tg.id_tag=tx.id_tag and tx.id_post=p.id_post) and hide<>1 ORDER BY p.date desc, p.time desc LIMIT 210,10

    выбираем все посты с определёнными тегами или без них
    удивляемся, почему тормозит пропорционально количеству тегов

    guest, 08 Августа 2009

    Комментарии (7)
  4. PHP / Говнокод #1490

    +142.5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    $out="<table valign=top>";
    for($k = 0; $k <= 6; $k += 1){     
        $sql="SELECT * FROM user_news1 ORDER BY date DESC LIMIT ".$k.",1";         
        $query=mysql_query($sql);
        $out.="<tr>";     
        while ($res=mysql_fetch_assoc($query)){
         $out.="<td style='vertical-align:top'>
               <div class=newsblock>
               <div class=newsdate>".date("d.m.Y G:i",strtotime($res['date']))."</div>
               <div class=newschapter><a href='/news/".$res['id'].".html'>".$res['header']."</a></div>
               ".($res['photo']!= '' ? " <a href='/news/".$res['id']."'><img src=/".str_replace(".", "_small.", $res['photo'])." class=imgnews border=0 align=left></a> " : "")."
               <div>".$res['announce']."</div></td>";
         }
        
        $out.="</tr>";
    }    
    $out.="</table>";
    
    
    echo $out;

    Вот как надо новости выводить:)

    guest, 07 Августа 2009

    Комментарии (24)
  5. PHP / Говнокод #1465

    +137.7

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $q = mysql_query ("SELECT * FROM theodorakisdiscographygre");
    $num_rows = mysql_num_rows($q);
    for ($m=0; $m<$num_rows; $m++)
    {
     $q = mysql_query ("SELECT * FROM theodorakisdiscographygre");
     for ($c=0; $c<($num_rows-$m); $c++)
     {
      $f = mysql_fetch_array($q);
     }
     echo $f["content"];
    }

    сортировка

    guest, 05 Августа 2009

    Комментарии (11)
  6. PHP / Говнокод #1448

    +148

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    if($_SESSION['login'])
    	{
    /*$topics=mysql_query("SELECT * FROM shviewstopic") or die ("Ошибка: Не могу выбрать таблицу для просмотра тем");
    while($topic=mysql_fetch_array($topics))
    	{
    			echo "Пусто";
    	}  */
    		$timestamp=time();
    		$ip = getenv("REMOTE_ADDR");	
    		mysql_query("UPDATE shsession SET user='".$_SESSION['login']."', timestamp='".$timestamp."', id='".$_SESSION['id']."' WHERE ip='".$ip."'") or die (mysql_error());
    	}

    сам не знаю, чего пытался сделать:)

    guest, 31 Июля 2009

    Комментарии (0)
  7. PHP / Говнокод #1399

    +132.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    include "include/template.php";
    stdhead(null,'Он-лайн табло');
    
    echo '<table><tr><td>';
    	$firarray = mysql_query("SELECT * FROM online_firs GROUP BY fir ASC");
    	while ($fir = mysql_fetch_array($firarray)){ // пробегаемся по РЦентрам 
    		$firnamearray = mysql_query("SELECT * FROM firdata WHERE fir='".$fir[fir]."'");
    		$firname = mysql_fetch_array($firnamearray); // получим название текущего РЦ
    
    		// вложенная таблица районного центра
    		echo '<table width=100%>';
    		echo '<tr><td background="images/airport_header.gif"> '.$fir[fir].'  '.$firname[name].' FIR</td></tr><tr><td>';
    		//вложенная таблица диспетчерских пунктров 
    		echo '<table>';
    		$atcarray = mysql_query("SELECT * FROM online WHERE atc_fir='".$fir[fir]."' and clienttype='ATC' ORDER BY atc_callsign ASC");
    		while ($atc = mysql_fetch_array($atcarray)){ // пробегаемся по позициям
    			// если позиция существует - то отображаем
    			$positionarray=explode("_",$atc[callsign]); //  расхуячиваем код позывного на Икао и  Позицию.
    			$positiontype=array_pop($positionarray); // выдёргиваем последний элемент, т.е. тип позиции (app twr gnd итд)
    			if (($positiontype=='GND') || ($positiontype=='TWR') || ($positiontype=='APP') || ($positiontype=='CTR') || ($positiontype=='FSS') || ($positiontype=='DEL') ){
    				// расхуячим АТИС построчно
    				$atis='';
    				$atisarray=explode("^§",$atc[atc_atis]); // разбираем общую строку на ВПП по разделителю %		
    				foreach ($atisarray as $x => $atisdetalis){  // пробегаем по всем параметрам ВПП, поочерёдно для каждой
    					$atis=$atis.$atisdetalis.'; ';}
    
    					echo '<tr style="color: #ff0000">'. // задаётся цвет шрифта 
    					'<td width="90">'.$atc[callsign]. '</td>'.
    					'<td width="200" title="'.$atis.'">'.$atc[atc_callsign]. '</td>'.
    					'<td width="90">'.$atc[atc_freq]. '</td>'.
    					'<td width="200" title="'.$atc[pid].' '.$atc[atc_rating].'"><a href="http://stats.vatsim.net/search_id.php?id='.$atc[pid].'">'.$atc[fio]. '</a></td></tr>';
    			}
    		}	
    		echo '</table >'; //закрывающий таблицы диспетчерских пунктов
    		//вложенная таблица ВС 
    		echo '<table >';
    		$portarray = mysql_query("SELECT * FROM online_firs WHERE fir='".$fir[fir]."' GROUP BY port ASC");
    		while ($port = mysql_fetch_array($portarray)){ // пробегаемся по портам
    			if ($port[port]){
    				// получим название аэродрома . И если есть такой АД в базе данных тогда добавим ссыль не его страницу
    				$airport = mysql_fetch_array(mysql_query("SELECT * FROM airportdata WHERE port='".$port[port]."' "));
    				$airportpage = mysql_fetch_array(mysql_query("SELECT * FROM airport WHERE ikao='".$port[port]."' "));
    				if ($airportpage[name]) $link='<a href="airport.php?icao='.$port[port].'"><img src="images/icon/info.png"></img> </a>';
    				echo '<tr><td colspan="8"> - '.$port[port].' '.$airport[name].' </td><td>'.$link.'</td></tr>'; $link='';
    				// получим прибытия и выведем нахуй
    				$arrivalarray = mysql_query("SELECT * FROM online WHERE fp_arrival_port='".$port[port]."' ORDER BY time_arr ASC");
    				while ($arrival = mysql_fetch_array($arrivalarray)){ // пробегаемся по прибытиям 
    
    					echo '<tr style="color: #000000">'. // задаётся цвет шрифта прибывающих
    					'<td width="90" title="'.$arrival[fio].'"><a href="http://vataware.com/pilot.cfm?cid='.$arrival[pid].' ">'.$arrival[callsign].' </a></td>'.
    					'<td width="95">'.$arrival[fp_acfttype].'</td>';
    					// Если расстояние до АД прилёта более 10 км
    					if ($arrival[dist_from_ad_arr] > 10) echo '<td width="65" title="Время прибытия">'.$arrival[time_arr].'</td>';
    					else echo'<td style="color: #a0a0a0" width="65" >arrived</td>';
    					echo'<td width="110" title="'.$arrival[fp_route].'">'.$arrival[fp_departure_port].'-'.$arrival[fp_arrival_port].'</td>'.
    					'<td width="100" title="Текущий эшелон | Эшелон по плану">FL'.ceil($arrival[alt]/100).'|'.$arrival[fp_flevel].'</td>'.
    					'<td width="40" title="Скорость (км/ч) ">'.ceil($arrival[speed]).'</td>'.
    					'<td width="40">'.$arrival[fp_sq].'</td></tr>';
    				}
    				// получим отправления и выведем нахуй
    				$departurearray = mysql_query("SELECT * FROM online WHERE fp_departure_port='".$port[port]."' ORDER BY time_arr ASC");
    				while ($departure = mysql_fetch_array($departurearray)){ // пробегаемся по прибытиям 
    					echo '<tr style="color: #a0a0a0">'. // задаётся цвет шрифта вылетающих
    					'<td width="90" title="'.$departure[fio].'"><a href="http://vataware.com/pilot.cfm?cid='.$departure[pid].'  " target="_blank">'.$departure[callsign].' </a></td>'.
    					'<td width="95" >'.$departure[fp_acfttype].'</td>';
    					// Если расстояние от АД вылета менее 60ти километов
    					if ($departure[dist_from_ad_dep] < 60) echo'<td width="65" >departing</td>';
    					else echo'<td width="65" >in flight</td>';
    					echo'<td width="110"  title="'.$departure[fp_route].'">'.$departure[fp_departure_port].'-'.$departure[fp_arrival_port].'</td>'.
    					'<td width="100"  title="Текущий эшелон | Эшелон по плану">FL'.ceil($departure[alt]/100).'|'.$departure[fp_flevel].'</td>'.
    					'<td width="40"  title="Скорость (км/ч) ">'.ceil($departure[speed]).'</td>'.
    					'<td width="40" >'.$departure[fp_sq].'</td></tr>';
    				}
    			}
    		}	
    		echo '</table >'; // закрывающий таблицы ВС
    	echo '</td></tr></table >'; // закрывающий таблицы РЦ
    	}
    echo '</td></tr></table >'; // закрывающий главной таблицы
    
    stdfoot(null);

    guest, 21 Июля 2009

    Комментарии (6)
  8. SQL / Говнокод #1367

    −859

    1. 1
    49512

    select * from dual

    guest, 13 Июля 2009

    Комментарии (0)
  9. PHP / Говнокод #1305

    +153

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <HTML>
        <HEAD>
        <title>
        </HEAD>
    <BODY>
    <?php
    include("connect.php");
    /* вводим переменную которая соединяется с бд */
            $db = @mysql_connect ($host, $user, $psw);
            mysql_query($db);
    /* выбираем бд с использованием предыдущей */
    /*переменной для соединения с бд*/
            $sdb = @mysql_select_db("zforum", $db);
    
    /* для наглядности показываем месагу результата выполнения скрипта */
    if(empty($sdb)) { $info=$info.mysql_error();
            };
    $datevar="date()";
    $usrn="select * from users where usrnick='$_POST[nick]'";
    $usrnick=mysql_query($usrn);
    $rows_usrnick=mysql_num_rows($usrnick);
    $usrm="select * from users where usrmail='$_POST[email]'";
    $usrmail=mysql_query($usrm);
    $rows_usrmail=mysql_num_rows($usrmail);
    $ins_new_usr="INSERT INTO users SET usrnick='$_POST[nick]', usrpsw='$_POST[pass]', usrmail='$_POST[email]',usrabout='$_POST[about]',regdate='$datevar'";
    ?>
    <form action=" <?php include("go_reg.php") ?>" method=post target="_self">
    <Table border="5">
    <tr><th COLSPAN=2>Registration form</th></tr>
    <tr><td>Nickname</td><td><input type="text" size=26 name="nick" maxlegth="16" size="16" value=""></td></tr>
    <tr><td>Password</td><td><input type="password" name="pass" size=26 maxlength=24 size="16" value=""></td></tr>
    <tr><td>Password again</td><td><input type="password" name="pass2" size=26 maxlength="24" size="16" value=""></td></tr>
    <tr><td>E-mail</td><td><input type="text" name="email" maxlength="50" size=26 value=""></td></tr>
    <tr><td>About</td><td><textarea name="about" maxlength="100" wrap="virtual" rows=4></textarea></tr>
    <tr><th colspan=2><input type="submit" value="enter"></th></tr>
    <h1> <?php echo("$info$error") ?> </h1>
    </table>
    
    
    2ой файл "go_reg.php"
    
    <?php
    if(isset($_POST[nick]) && isset($_POST[pass]) && isset($_POST[pass2]) && isset($_POST[email]))
       {
    if($rows_usrnick>0) {$error="Такой ник уже занят<BR>";
       }
    if($rows_usrmail>0) {$error="$error На этот е-меил уже зарегистрирован пользователь<BR>";
       }
    if($_POST[pass2]==$_POST[pass]) {;} else {$error="$error Пароль введен не верно<BR>";
    }
    };
    if(!isset($error)) {mysql_query($ins_new_usr);}
    ?>
    </body>

    guest, 01 Июля 2009

    Комментарии (1)
  10. PHP / Говнокод #1251

    +153

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    <?
    ob_start();
    session_start();
    include("includes/applicationTop.php");
    ?>
    <?
    if($_SESSION["CONTACT_ID"]=="" || $_SESSION["CONTACT_ID"]==0)
    {
    	$contact_id=$_GET['contact_id'];
    }
    else
    {
    	$contact_id = $_SESSION["CONTACT_ID"];
    }
    if($_SESSION["ORDER_ID"]=="" || $_SESSION["ORDER_ID"]==0)
    {
    	$order_id=$_GET['order_id'];
    }
    else
    {
    	$order_id = $_SESSION["ORDER_ID"];
    }
    
    $selBillingInfo = "SELECT * FROM `contact` WHERE `contact_id`='".$contact_id."'";
    $resBillingInfo = $db->select_data($selBillingInfo);
    $selOrderInfo = "SELECT * FROM `order` WHERE `order_id`='".$order_id."'";
    $resOrderInfo = $db->select_data($selOrderInfo);
    ?>
    <? $exesql=mysql_query("select * from admin_updation where id = 1"); 
    $rs=mysql_fetch_object($exesql); $to_mail=$rs->paypal_id;?> 
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
    	<td width="30"><img src="images/spacer.gif" width="30" height="1" /></td>
    	<td><form class="formclass" method="post" action="https://www.paypal.com/cgi-bin/webscr"  id="myform" name="theForm" ><!--<form class="formclass" method="post" action="https://www.paypal.com/cgi-bin/webscr"  id="myform" name="theForm" >-->
    		<input name="validate" value="1" type="hidden">
    		<input type="hidden" name="order_id" value="<?=$order_id?>" />
    		<?
    		$paypal[site_url]="http://говносайт";
    		$paypal[success_url]="/paymentReceipt.php?success=paypal&pt=paypal&contact_id=$contact_id&order_id=$order_id";
    		$paypal[cancel_url]="/paymentReceipt.php?success=failed&pt=paypal&contact_id=$contact_id&order_id=$order_id";
    		$paypal[notify_url]="/ipn/ipn.php";
    		$paypal[return_method]="2"; //1=GET 2=POST
    		$paypal[currency_code]="USD"; //[USD,GBP,JPY,CAD,EUR]
    		$paypal[lc]="US";
    		$paypal[url]="https://www.sandbox.paypal.com/cgi-bin/webscr"; // For Test 
    		$paypal[post_method]="fso"; //fso=fsockopen(); curl=curl command line libCurl=php compiled with libCurl support
    		$paypal[curl_location]="/usr/local/bin/curl";
    		$paypal[bn]="toolkit-php";
    		$paypal[cmd]="_xclick";
    		$paypal[display_comment]="0"; //0=yes 1=no
    		$paypal[comment_header]="Comments";
    		$paypal[continue_button_text]="Continue >>";
    		$paypal[background_color]="1"; //""=white 1=black
    		$paypal[display_shipping_address]="1"; //""=yes 1=no
    		$paypal[display_comment]="1"; //""=yes 1=no
    		?>
    		<!--<input type="hidden" name="business" value="[email protected]">--><? // For Live ?>
    		
    		<input type="hidden" name="business" value="<?=$to_mail?>"><? // For Test ?>
    		<!--<input type="hidden" name="business" value="[email protected]">--><? // For Test ?>
    		<input type="hidden" name="item_name" value="Говнобрэнд">
    		<input type="hidden" name="cmd" value="<?=$paypal[cmd]?>">
    		<input type="hidden" name="redirect_cmd" value="<?=$paypal[cmd]?>">
    		<input type="hidden" name="image_url" value="">
    		<input type="hidden" name="return" value="<? echo "$paypal[site_url]$paypal[success_url]"; ?>">
    		<input type="hidden" name="cancel_return" value="<? echo "$paypal[site_url]$paypal[cancel_url]"; ?>">
    		<input type="hidden" name="notify_url" value="<? echo "$paypal[site_url]$paypal[notify_url]"; ?>">
    		<input type="hidden" name="rm" value="<?=$paypal[return_method]?>">
    		<input type="hidden" name="currency_code" value="<?=$paypal[currency_code]?>">
    		<input type="hidden" name="lc" value="<?=$paypal[lc]?>"><input type="hidden" name="bn" value="<?=$paypal[bn]?>">
    		<input type="hidden" name="cbt" value="<?=$paypal[continue_button_text]?>"><input type="hidden" name="no_shipping" value="<?=$paypal[display_shipping_address]?>">
    		<input type="hidden" name="no_note" value="<?=$paypal[display_comment]?>">
    		<input type="hidden" name="order_id" value="<?=$order_id?>"><input type="hidden" name="amount" value="<?=$resOrderInfo[0]['amount']?>">
    		<input type="hidden" name="first_name" value="<?=$resBillingInfo[0]['first_name']?>">	<input type="hidden" name="last_name" value="<?=$resBillingInfo[0]['last_name']?>">
    		<input type="hidden" name="company" value="<?=$resBillingInfo[0]['company']?>"><input type="hidden" name="address" value="<?=$resBillingInfo[0]['address']?>">
    		<input type="hidden" name="city" value="<?=$resBillingInfo[0]['city']?>"><input type="hidden" name="state" value="<?=$resBillingInfo[0]['state']?>">
    		<input type="hidden" name="zip" value="<?=$resBillingInfo[0]['zip']?>">
    		<input type="hidden" name="country" value="<?=$resBillingInfo[0]['country']?>">
    		<input type="hidden" name="phone" value="<?=$resBillingInfo[0]['phone']?>"> 	<input type="hidden" name="email " value="<?=$resBillingInfo[0]['email']?>">	<input type="hidden" name="a3" value="<?=$resOrderInfo[0]['amount']?>">
    		<input type="hidden" name="p3" value="1">	<input type="hidden" name="t3" value="M"> <input type="hidden" name="no_note" value="1">
    		<input type="hidden" name="src" value="1"><input type="hidden" name="sra" value="1">
    		<table width="100%" border="0" cellspacing="0" cellpadding="0">
    		  <tr>
    			<td class="text_body">&nbsp;</td>
    		  </tr>
    		  <tr>
    			<td align="left"></td>
    		  </tr>
    		</table>
    	  </form></td>
    	<td width="15"><img src="images/spacer.gif" width="15" height="1" /></td>
      </tr>
    </table>
    <script language="JavaScript">
    objfrm = document.getElementById("myform");
    objfrm.submit();
    </script>

    А вот занятный способ переброса посетителя на paypal.
    С помощью невидимой формы, который сама засабмитится (может быть).

    Источник тот же, что у #1244-#1245, #1248-#1250

    guest, 25 Июня 2009

    Комментарии (8)
  11. PHP / Говнокод #1245

    +140.9

    1. 1
    2. 2
    3. 3
    $sqlt="select * from logos where is_delete='0'";
    $rest=$db->select_data($sqlt);
    $total=count($rest);

    Подсчет подходящих записей в таблице.
    Источник тот же, что и у говнокода 1244.
    В $rest возвращается ассоциативный массив.

    guest, 24 Июня 2009

    Комментарии (0)