1. Лучший говнокод

    В номинации:
    За время:
  2. 1C / Говнокод #5174

    −127

    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
    Запрос = Новый Запрос(
    	"ВЫБРАТЬ
    	|    РегШК.Владелец                   КАК Владелец,
    	|    РегШК.ЕдиницаИзмерения           КАК ЕдиницаИзмерения,
    	|    РегШК.ХарактеристикаНоменклатуры КАК ХарактеристикаНоменклатуры
    	|ИЗ
    	|    РегистрСведений.Штрихкоды        КАК РегШК
    	|ГДЕ
    	|    РегШК.Штрихкод = &Штрихкод");
    	
    	Запрос.УстановитьПараметр("Штрихкод", Штрихкод);
    	РезультатЗапроса = Запрос.Выполнить();
    	
    	//Николай
    	Если РезультатЗапроса.Пустой() Тогда
    		Штрихкод=Сред(Штрихкод,7,6);
    		Запрос = Новый Запрос(
    		"ВЫБРАТЬ
    		|    РегШК.Владелец                   КАК Владелец,
    		|    РегШК.ЕдиницаИзмерения           КАК ЕдиницаИзмерения,
    		|    РегШК.ХарактеристикаНоменклатуры КАК ХарактеристикаНоменклатуры
    		|ИЗ
    		|    РегистрСведений.Штрихкоды        КАК РегШК
    		|ГДЕ
    		|    РегШК.Штрихкод = &Штрихкод");
    		
    		Запрос.УстановитьПараметр("Штрихкод", Штрихкод);
    		РезультатЗапроса = Запрос.Выполнить();
        КонецЕсли;
    	
    	//Николай

    Вот как надо выполнять тот же запрос, но с другим параметром!

    alex-makhnev, 07 Января 2011

    Комментарии (13)
  3. Perl / Говнокод #5173

    −123

    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
    # Обработка нажатия клавиш
    # Если нажата кнопка СОХРАНИТЬ
    if(CGI::param('sub_data_save'))
    {
      if(CGI::param('content')){ $content=CGI::param('content'); }
    	
      $content=~s/'/\\'/g;	
      $dbh->do("update public.m_content set content='$content' where id=70");
                                                                                                                                 
      # Зафиксировали изменения
      $dbh->commit;
                                                                                                                                 
      # формируем страницу
      md::tools->create_page($www{'main_template'},"<#CONTENT#>",$content,$www{'path'},'/turfirm.php');
    
      # подгонка остальных страниц
      # новости
      $sql = "select content from public.m_content where \"id\"=20";
      $sth=$dbh->prepare($sql);
      $sth->execute;
      ($content0)=$sth->fetchrow_array;
      md::tools->create_page($www{'main_template'},"<#CONTENT#>",$content0,$www{'path'},'/news.php');
      # Корпаративным клиентам
      $sql = "select content from public.m_content where \"id\"=60";
      $sth=$dbh->prepare($sql);
      $sth->execute;
      ($content0)=$sth->fetchrow_array;
      md::tools->create_page($www{'main_template'},"<#CONTENT#>",$content0,$www{'path'},'/cor_clients.php');
      # Главная
      $sql = "select content from public.m_content where \"id\"=10";
      $sth=$dbh->prepare($sql);
      $sth->execute;
      ($content0)=$sth->fetchrow_array;
      md::tools->create_page($www{'main_template'},"<#CONTENT#>",$content0,$www{'path'},'/index.php');
      # Контакты
      $sql = "select content from public.m_content where \"id\"=30";
      $sth=$dbh->prepare($sql);
      $sth->execute;
      ($content0)=$sth->fetchrow_array;
      md::tools->create_page($www{'main_template'},"<#CONTENT#>",$content0,$www{'path'},'/contact.php');
      # Базы
      $sql = "select content from public.m_content where \"id\"=40";
      $sth=$dbh->prepare($sql);
      $sth->execute;
      ($content0)=$sth->fetchrow_array;
      md::tools->create_page($www{'main_template'},"<#CONTENT#>",$content0,$www{'path'},'/centre.php');
      # Бронирование
      $content0="<iframe width=100% scrolling='auto' height=100% frameborder=0 src='/cgi-bin/res.cgi' ></iframe>";
      md::tools->create_page($www{'main_template'},"<#CONTENT#>",$content0,$www{'path'},'/reservation.php'); 
    }

    Из админки одного сайта
    (админка - один сплошной перл)

    happy_me, 07 Января 2011

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

    +150

    1. 1
    for($i = 1;; $i++){if ($i > $r) break; echo $i;}

    Oonitaz, 05 Января 2011

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

    +157

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    <?php
    //............
    if (!eregi("^([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)$", $_POST[mail]))
    {
    echo"Адрес E-mail,веден неверно.<br /><br />";
    echo"Вы хотите <a href=\"index.php\">Повторить</a>";
    exit;
    }
    
    //............
    ?>

    Зачем ввобще придумали preg_match ?

    iNeeXT, 29 Декабря 2010

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

    +170

    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
    <?
    include('db_access.php');
    include('db_mysql.inc');
    
    $db=new DB_sql;
    $db->connect($DB_NAME,$HOST,$USER,$PASSWD);
    
    $db2=new DB_sql;
    $db2->connect($DB_NAME,$HOST,$USER,$PASSWD);
    
    $db3=new DB_sql;
    $db3->connect($DB_NAME,$HOST,$USER,$PASSWD);
    ?>

    С сайта на самописном движке. Будет время - поковыряюсь ещё. Дико интересно, используются ли там все три коннекта.

    telnet, 27 Декабря 2010

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

    +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
    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
    $link = 'http://www.logofon.ru/xml/ips.xml';
    
    $file = win_to_utf(file_get_contents($link));
    
    $file = trim(substr((substr($file,0,strripos($file,'</operators>'))),(stripos($file,'<operators>') + 11)));
    
    #echo substr_count($file,'<operator').'<br />';
    
    #preg_match_all('|\<operator(.*)\>(.*)\<\/operator\>|sUu',$file,$res);
    #array_dump($res);
    
    preg_match_all('|\<operator id="([0-9]*)" name="([[:space:]a-zA-Zа-яА-ЯёЁ0-9-(){}_.:]*)" label="([[:space:]a-zA-Z0-9]*)" tld="([a-zA-Z0-9]*)" country="([[:space:]a-zA-Zа-яА-Я0-9-(){}_.]*)" publish="([0-9]*)"\>(.*)\<\/operator\>|Usu',$file,$result);
    
    
    
    //-- Количество операторов
    $count_oper = count($result[0]);
    
    //-- Массив операторов
    $operators = array();
    
    //-- Запускаем цикл
     for($i = 0;$i < $count_oper; $i ++)
    {
    //-- Массив текущего оператора
    $operators[$i] = array();
    
    $operators[$i]['id'] = $result[1][$i];
    $operators[$i]['name'] = $result[2][$i];
    #$operators[$i]['label'] = $result[3][$i];
    $operators[$i]['tld'] = $result[4][$i];
    $operators[$i]['country'] = $result[5][$i];
    
    
    
    //-- Создаем базы IP
    $operators[$i]['ip'] = array();
    
    preg_match_all('|\<range ip1="([0-9]{10})" ip2="([0-9]{10})" mode="([0-9]*)" \/\>|Usu',$result[7][$i],$result2);
    #echo '<b>#'.($i + 1).'.</b>'.htmlspecialchars($result[7][$i]).'<br />';
    #array_dump($result2);
    
    //-- Количество диапазанов для текущего опера
    $count_ip = count($result2[0]);
    
    //-- Еще один цикл
      for($j = 0;$j < $count_ip; $j ++)
     {
     	query("INSERT INTO `$db[prefix]ips` SET `name`='{$operators[$i]['name']}',`id_op`='{$operators[$i]['id']}',`country`='{$operators[$i]['country']}',`tld`='{$operators[$i]['tld']}',`ip1`='{$result2[1][$j]}',`ip2`='{$result2[2][$j]}' ")or my_error();
    # $operators[$i]['ip'][$j] = array($result2[1][$j],$result2[2][$j]);
    #echo long2ip($result2[1][$j]).' --- '.long2ip($result2[2][$j]).'<br />';
     }
    
    }
    
    
    echo 'Операторов после : <b>'.($count_op_after = mysql_num_rows(query("SELECT COUNT(*) FROM `$db[prefix]ips` GROUP BY `id_op` "))).'</b><br />';
    echo 'Диапазонов после : <b>'.($count_di_after = mysql_result(query("SELECT COUNT(*) FROM `$db[prefix]ips` "),0)).'</b><br />';

    Парсинг диапазонов IP мобильных операторов

    Morgan, 22 Декабря 2010

    Комментарии (13)
  8. C# / Говнокод #5016

    +118

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public void AllSolutionButtons(bool TrueOrFalse)
            {
                SetButtons("TopCorners", TrueOrFalse);
                SetButtons("TopWings", TrueOrFalse);
                SetButtons("BottomCorners", TrueOrFalse);
                SetButtons("BottomWings", TrueOrFalse);
                SetButtons("middleSlice", TrueOrFalse);
                SetButtons("Solve", TrueOrFalse);
            }

    У меня зла не хватает ...... как вообще так можно писать ... а главное как такое придумать можно %)

    Arbium, 22 Декабря 2010

    Комментарии (13)
  9. Куча / Говнокод #5013

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    212.176.111.43 - - [21/Dec/2010:20:54:58 +0300] "GET /index.php?inc=43405 HTTP/1.0" 200 5324 "-" "Nechego Byilo Vesti Sebya Po Svinski"
    212.176.111.43 - - [21/Dec/2010:20:54:58 +0300] "GET /index.php?inc=78686 HTTP/1.0" 200 5324 "-" "Nechego Byilo Vesti Sebya Po Svinski"
    212.176.111.43 - - [21/Dec/2010:20:54:58 +0300] "GET /index.php?inc=9113 HTTP/1.0" 200 5324 "-" "KomprendaTrueTrolle"
    212.176.111.43 - - [21/Dec/2010:20:54:58 +0300] "GET /index.php?inc=16996 HTTP/1.0" 200 5324 "-" "Nechego Byilo Vesti Sebya Po Svinski"
    212.176.111.43 - - [21/Dec/2010:20:54:58 +0300] "GET /index.php?inc=37937 HTTP/1.0" 200 5324 "-" "Nechego Byilo Vesti Sebya Po Svinski"
    212.176.111.43 - - [21/Dec/2010:20:54:58 +0300] "GET /index.php?inc=78866 HTTP/1.0" 200 5324 "-" "Nechego Byilo Vesti Sebya Po Svinski"
    212.176.111.43 - - [21/Dec/2010:20:54:58 +0300] "GET /index.php?inc=79800 HTTP/1.0" 200 5324 "-" "Nechego Byilo Vesti Sebya Po Svinski"
    212.176.111.43 - - [21/Dec/2010:20:54:58 +0300] "GET /index.php?inc=17157 HTTP/1.0" 200 5324 "-" "Nechego Byilo Vesti Sebya Po Svinski"
    212.176.111.43 - - [21/Dec/2010:20:54:58 +0300] "GET /index.php?inc=27515 HTTP/1.0" 200 5324 "-" "KomprendaTrueTrolle"

    некто под ником itsem ищет php-injection

    KomprendaTerrorSquad, 21 Декабря 2010

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

    +170

    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
    if($pnumber < $max)
              {
                if ($number > 5) $start="<a class='guest' href=goods.php?page=".$page."&n=1 title=Первая страница>1</a>&nbsp;";
                if ($number < $pages-4) $last="&nbsp;<a class='guest' href=goods.php?page=".$page."&n=".$pages." title=Последняя страница>".$pages."</a>";
                if ($number > 4) $pointleft="... ";
                if ($number <= $pages-4) $pointright=" ...";
                if ($number != 1) $prevpage="<a class='guest' href=goods.php?page=".$page."&n=".($number-1)." title=Назад>&lt;&lt;</a>&nbsp;&nbsp;";
                if ($number != $pages) $nextpage="&nbsp;&nbsp;<a class='guest' href=goods.php?page=".$page."&n=".($number+1)." title=Вперед>&gt;&gt;</a>";
                if ($number-3 > 0) $page3left="<a class='guest' href=goods.php?page=".$page."&n=".($number-3)." title=Страница&nbsp;".($number-3).">".($number-3)."</a> | ";
                if ($number-2 > 0) $page2left="<a class='guest' href=goods.php?page=".$page."&n=".($number-2)." title=Страница&nbsp;".($number-2).">".($number-2)."</a> | ";
                if ($number-1 > 0) $page1left="<a class='guest' href=goods.php?page=".$page."&n=".($number-1)." title=Страница&nbsp;".($number-1).">".($number-1)."</a> | ";
                if ($number+1 <= $pages) $page1right=" | <a class='guest' href=goods.php?page=".$page."&n=".($number+1)." title=Страница&nbsp;".($number+1).">".($number+1)."</a>";
                if ($number+2 <= $pages) $page2right=" | <a class='guest' href=goods.php?page=".$page."&n=".($number+2)." title=Страница&nbsp;".($number+2).">".($number+2)."</a>";
                if ($number+3 <= $pages) $page3right=" | <a class='guest' href=goods.php?page=".$page."&n=".($number+3)." title=Страница&nbsp;".($number+3).">".($number+3)."</a>";
                echo "<tr><td colspan='2'><p style='text-align:center;'><font class='guest'>".$prevpage.$start.$pointleft.$page3left.$page2left.$page1left.$number."/".$pages.$page1right.$page2right.$page3right.$pointright.$last.$nextpage."</font></p></td></tr>";
              }

    Пейджинг страниц

    RReverser, 19 Декабря 2010

    Комментарии (13)
  11. JavaScript / Говнокод #4948

    +168

    1. 1
    2. 2
    3. 3
    $.each( $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().next().find(".det-project"), function(i, item) { 
        $tracks.push( $(item).attr("rel") ); 
    });

    Проверял какой код ребята из команды написали - нашел вот такое.

    Mike, 16 Декабря 2010

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