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

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

    Найдено: 384

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

    +151

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $sql=@mysql_query("SELECT * FROM `table` WHERE `mobile`='".$mobile."'");
    $num=mysql_num_rows($sql);
    $r = mysql_fetch_array($sql);
    if ($num==0 || $num<1)
    {
    echo 0;
    }

    :D:D:D

    swing1991, 22 Июля 2011

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

    +165

    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
    <?
    mysql_connect("localhost", "root",""); mysql_select_db("BD");
    //$zapros=mysql_query("select * from test where id=0"); //echo ($zapros);
    function menu($parent,$h) { $h++;
    $zapros=mysql_query("select * from test where id={$parent}");
    while($row=mysql_fetch_array($rezult)) { echo "{$row['name']}
    "; 
    $zapros1=mysql_query("select * from test where key={$row['id']}");
    while ($row1=mysql_fetch_array($zapros1)){ echo " 
    {$row1['name']}
    "; $p=$row1['id']; menu($p,$h);
    }
    }
    }
    
    menu(0,0);
    ?>

    qbasic, 20 Июля 2011

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

    +162

    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
    /*Проверка авторизации*/
    if ($action == 'login') {
     if (($entlogin && $entpass) <> '') {
      $per = "SELECT * FROM ".$sql_dop."users";
      if(!mysql_query($per)) {
       $page = 'error';
       $id = '2,1,1';
      }
      $result = mysql_query($per);
      $qwe = 0;
      while ($row = mysql_fetch_row($result)) {
       if ($entlogin == $row[1] && md5($entpass) == $row[2]) {
        $qwe = 1;
    	$date = date("d m Y H:i:s");
    	$mmsec = microtime(msec);
    	$kod = md5($date.$row[0].$row[1].$row[2].$mmsec);
    
    	$does_into_sessions = "INSERT INTO ".$sql_dop."sessions(user,kod) VALUES ('$row[0]','$kod')";
    	if(!mysql_query($does_into_sessions)) {
    	error(3,1,1);
    	}				
    	setcookie('session_code', $kod);
    	$ubr = 1;
    	if ($row[10] == 2) {
    		$urb = 2;
    	}
    	if ($row[10] == 3) {
    		$urb = 2;
    	}
    	setcookie('userbar', $urb);
    	$session_code = $kod;
    	$page = '';
       }
      }
     } else {
       $page = 'error';
       $id = '5,0,0';
    
     }
     if ($qwe == 0) {	
    	echo "<strong>Ошибка авторизации...</strong>";
    	echo "<meta http-equiv='refresh' content='1; url=index.php'>";
    	exit();
     }
    }

    Авторизация от старого программиста

    Amadey, 16 Июля 2011

    Комментарии (22)
  5. SQL / Говнокод #7219

    −852

    1. 1
    SELECT * FROM users WHERE sex=1;

    Долго думал, sex=1 это мужики или дамы. Оказалось мужики.

    stillwaiting, 11 Июля 2011

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

    +163

    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
    $res=mysql_query("SELECT * FROM `admin` ");
       $nam=mysql_result($res, 0, "name");
       $psw=mysql_result($res, 0, "pass");
       $snm=mysql_result($res, 0, "sitename");
       $ops=mysql_result($res, 0, "opis");
       $key=mysql_result($res, 0, "keyw");
       $rul=mysql_result($res, 0, "rules");
       $mls=mysql_result($res, 0, "lst");
       $mnm=mysql_result($res, 0, "mxnm");
       $mur=mysql_result($res, 0, "mxur");
       $mop=mysql_result($res, 0, "mxop");
       $mky=mysql_result($res, 0, "mxky");
       $mem=mysql_result($res, 0, "mxem");
       $mps=mysql_result($res, 0, "mxps");
       $mil=mysql_result($res, 0, "mail");
       $adr=mysql_result($res, 0, "adres");
       $logo=mysql_result($res, 0, "logo");
       $txlogo=mysql_result($res, 0, "txlogo");
       $copir=mysql_result($res, 0, "copirat");
       $blokrekl=mysql_result($res, 0, "blokrekl");

    Rinat, 04 Июля 2011

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

    +159

    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
    $get = dbcom('SELECT * FROM downloads ORDER BY views DESC;');
    			$i = 1;
    			while($row = mysql_fetch_array($get))
    			{
    				if($i == 1)
    				{
    					$p['v'] = $row['views'];
    				}
    				if($row['reports'] != 0)
    				{
    					$t['rep']++;
    				}
    				$t['dl'] += $row['views'];
    				$i = 0;
    			}

    DDLCMS is a COMMERCIAL grade content management system for DDL site owners.
    при 400к записях в downloads немножно все в ОЗУ не помещалось.

    peinguin, 28 Июня 2011

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

    +156

    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
    <?php 
    	if(isset($_GET["status"])) {
    		//Определяем переменные
    		$user_id = $_GET['user_id'];
    		$operator_id = $_GET['operator_id'];
    		$smsid = $_GET['smsid'];
    		$operator_id_str = $_GET['operator_id_str'];
    		$num = $_GET['num'];
    		$msg_trans = $_GET['msg_trans'];
    		$msg = $_GET['msg'];
    		$cost_rur = $_GET['cost_rur'];
    		$ratepoints = $cost_rur; //Рейтинг = стоимость смс
    		
    		//Подключаемся к бд
    		$dblocation = "localhost";	 // Имя сервера
    		$dbuser = "****";          // Имя пользователя
    		$dbpasswd = "******";            // Пароль
    		$dbname = "******"; //Имя бд
    		$dbcnx = @mysql_connect($dblocation,$dbuser,$dbpasswd);
    		if (!$dbcnx) {
    			  echo("Не удалось установить соеденение");
    			  exit();
    		} else  {
    						if (!@mysql_select_db($dbname, $dbcnx)) {
    							  echo  "База данных недоступна <br />" ;
    							  exit();
    						} else {
    							//Проверяем зарегестрирован ли пользователь
    							$changeuser = @mysql_query("SELECT * FROM jos_users WHERE  username='$user_id'");
    							if(@mysql_num_rows($changeuser) > 0) {
    							//Пользователь зарегестрирован
    								@mysql_query("INSERT INTO sms (operator_id, operator_id_str, user_id, smsid, num, msg_trans, msg, cost_rur) VALUES ('$operator_id','$operator_id_str','$user_id','$smsid','$num','$msg_trans','$msg','$cost_rur')"); //Добавляем смс
    								@mysql_query("UPDATE jos_users SET rate = rate +1 WHERE username='$user_id'"); //Увеличиваем рейтинг
    								@mysql_query("UPDATE jos_users SET sms = sms +1 WHERE username='$user_id'"); //Увеличиваем кол-во смс
    								$rate = @mysql_fetch_array(@mysql_query("SELECT rate FROM jos_users WHERE username='$user_id'"));
    								echo "SMS Send OK rate +1 your rate: ".$rate['rate']."";
    							} else {
    							/*Пользователь не зарегестрирован,
    							Регестрируем пользователя*/
    							$regdate = date("Y-m-d  H:i:s");
    							
    							//Генерируем пароль
    							$pass = rand(10000, 99999);
    							$sqlpass = md5($pass);
    							
    							//Добавляем пользователя
    								@mysql_query("INSERT INTO jos_users (name, username, password, usertype, gid, registerDate, lastvisitDate) VALUES ('$user_id', '$user_id', '$sqlpass', 'Registered', '18', '$regdate', '$regdate')");
    								$getnewuserid = @mysql_fetch_array(@mysql_query("SELECT id FROM jos_users WHERE username='$user_id'"));
    								@mysql_query("INSERT INTO jos_core_acl_aro (section_value, value, order_value, name, hidden) VALUES ('users', '{$getnewuserid['id']}', '0', '$user_id', '0')");
    								$getaro_id = @mysql_fetch_array(@mysql_query("SELECT id FROM jos_core_acl_aro WHERE name='$user_id'"));
    								@mysql_query("INSERT INTO jos_core_acl_groups_aro_map (group_id, aro_id) VALUES ('18', '{$getaro_id['id']}')");
    								
    								@mysql_query("INSERT INTO sms (operator_id, operator_id_str, user_id, smsid, num, msg_trans, msg, cost_rur) VALUES ('$operator_id','$operator_id_str','$user_id','$smsid','$num','$msg_trans','$msg','$cost_rur')"); 
    								@mysql_query("UPDATE jos_users SET rate = rate +1 WHERE username='$user_id'");
    								@mysql_query("UPDATE jos_users SET sms = sms +1 WHERE username='$user_id'");
    								$rate = @mysql_fetch_array(@mysql_query("SELECT rate FROM jos_users WHERE username='$user_id'"));
    								echo "SMS Register complete. Login: ".$user_id." Pass: ".$pass." Your rate: ".$rate['rate']."";
    							}
    									}
    			}
    	}
    ?>

    phplamer, 20 Июня 2011

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

    +158

    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
    //Отображеие меню
    	$arr = get("select max(depth) as d from ".DP."docs");
    	$to = $arr[0]['d'];
    
    	$a = get("select * from ".DP."docs where depth='0' order by prior");
    	$arr = $a;
    	for($i=0;$i<=$to;$i++)
    	{
    		$a = get("select * from ".DP."docs where depth='".$i."' order by prior");
    		if(is_array($a))
    		foreach($a as $key=>$value)
    		{
    			$b = array();$af = array();$bf = array();
    			$b = get("select * from ".DP."docs where pid='".$a[$key]['id']."' order by prior");
    			if(!$b)$b = array();
    			$before = true;
    			//поиск в массиве
    			foreach($arr as $key2=>$value2)
    			{
    				if($arr[$key2]['id'] != $a[$key]['id'] and $before) $bf[] = $arr[$key2];
    				if($arr[$key2]['id'] == $a[$key]['id'] ){ $bf[] = $arr[$key2]; $before=false;}
    				if($arr[$key2]['id'] != $a[$key]['id'] and !$before) $af[] = $arr[$key2];
    			}
    			$arr = array_merge($bf,$b,$af);
    		}
    	}

    построение дерева сайта. хотя может я не разобрался, весь код пестрит такими перлами.

    com1, 12 Июня 2011

    Комментарии (23)
  10. Java / Говнокод #6907

    +147

    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
    Query query = entityManager.createNativeQuery(
                            "select * from ("
                                    + "select g4.id as goodId, g4.name as goodName, g4.code as goodCode, "
                                    + "u4.name as uomName, sum(bgd.quantity_out) as quantityOut, "
                                    + " g4.productcode as goodProductCode, sum(bgd.quantity_return) as quantityReturn "
                                    + "from good g4 "
                                    + "inner join consignment cs1 on cs1.good_id = g4.id "
                                    + (customizationUtilSQL == null ? "" : customizationUtilSQL.buildCustomAttributesQueryInnerPart())
                                    + " inner join "
                                    + "(select gg.consignment_id, op.sourcestore_id as place_id, " +
                                    		" sum(gg.quantity) as quantity_out, sum(coalesce(srset.return_quantity, 0)) as quantity_return "
                                    + "from motion gg "
                                    + "inner join operation op " +
                                    		" on (gg.operation_id = op.id " +
                                    		" and op.company = gg.company" +
                                            (projectId == null ? "" : " and (op.project_id  = :projectId) ") +
                                            (contractId == null ? "" : " and (op.contract_id  = :contractId) ") +
                                    		") "
                                    + "inner join place pld on op.sourcestore_id = pld.id "
                            		+ " left outer join "
                    				+ " (select ds.demand_id as demand_id, srm.consignment_id as consignment_id, srm.sum as sum, " +
                    						" sum(srm.quantity) as return_quantity from demand_salesreturn ds " +
                    						" inner join operation sr on sr.id = ds.salesreturn_id " +
                    						" inner join motion srm on srm.operation_id = sr.id " +
                    						" where sr.dtype = 'SalesReturn' " +
                                            " and sr.deleted is null " +
                                            (!includeAboardOperations ? " and sr.applicable = true " : "") +
                                            " and (sr.moment between :upToDate and :toDate) " +
                                            " and " + SecurityUtil.companyFilterSQL("sr") +
                    						" group by ds.demand_id, srm.consignment_id, srm.sum) srset " +
                    						" on (srset.demand_id = op.id and srset.sum = gg.sum " +
                    						" and srset.consignment_id = gg.consignment_id) "
                                    + (agentId == null ? "" :
                                        " left outer join requisite tr on op.targetagentrequisite_id = tr.id "
                                        + " left outer join requisite sr on op.sourceagentrequisite_id = sr.id "
                                        + " left outer join agent agt on tr.agent_id = agt.id "
                                		+ " left outer join agent ags on sr.agent_id = ags.id ")
                                    + "where " + SecurityUtil.companyFilterSQL("op")
                                    + " and op.deleted is null "
                                    + (!includeAboardOperations ? " and op.applicable = true " : "")
                                    + " and (op.moment between :upToDate and :toDate) "
                                    + " and op.dtype = 'Demand' "
                                    + (agentId == null ? ""
                                        : " and ((ags.path || ags.id) like ( "
                                            + "select distinct (a21.path || a21.id || '%') from agent a21  where a21.id = :agentId) or "

    всё не влезло, вообще тут 65 строк. пожалуйста выскажите ваше мнение об этом коде. спасибо :)

    ab368, 09 Июня 2011

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

    +168

    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
    function ($param)
    {
    	$cnt = 0;
    
    	$result = mysql_query("SELECT * FROM `table` WHERE `table_field` = ".$param);
    
    	if ($result) 
    	{
    		while($row_s = mysql_fetch_assoc($result))
    		{
    			$cnt++;
    		}
    	}
    	else 
    	{
    		$cnt = 0;
    	}
    
    	return $cnt;
    }

    Шедевр неизвестного программиста.

    devl, 08 Июня 2011

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