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

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

    +152.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
    <ul>
            \\\".listQuery(\\\"SELECT Hidden_URL, Subdivision_Name, Subdivision_ID FROM Subdivision WHERE Parent_Sub_ID = \\\$data[Subdivision_ID] and checked=1 order by priority \\\", \\\"
            <li><a href='\\\\\\\$data[Hidden_URL]'>\\\\\\\$data[Subdivision_Name]</a>
    
                <ul>
                    \\\\\\\".listQuery(\\\\\\\"SELECT Hidden_URL, Subdivision_Name, Subdivision_ID FROM Subdivision WHERE Parent_Sub_ID = \\\\\\\$data[Subdivision_ID] and checked=1 order by priority \\\\\\\", \\\\\\\"
                    <li><a href='\\\\\\\\\\\\\\\$data[Hidden_URL]'>\\\\\\\\\\\\\\\$data[Subdivision_Name]</a>
    
                    <ul>
                         \\\\\\\\\\\\\\\".listQuery(\\\\\\\\\\\\\\\"SELECT Hidden_URL, Subdivision_Name, Subdivision_ID FROM Subdivision WHERE Parent_Sub_ID = \\\\\\\\\\\\\\\$data[Subdivision_ID] and checked=1 order by priority \\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"
                         <li><a href='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\$data[Hidden_URL]'>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\$data[Subdivision_Name]</a>
    
                         <ul>
                             \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\".listQuery(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"SELECT Hidden_URL, Subdivision_Name, Subdivision_ID FROM Subdivision WHERE Parent_Sub_ID = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\$data[Subdivision_ID] and checked=1 order by priority \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
                             <li><a href='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\$data[Hidden_URL]'>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\$data[Subdivision_Name]</a>
                             <ul></ul></li>
    
                             \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\").\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
                         </ul></li>
    
    
                         \\\\\\\\\\\\\\\").\\\\\\\\\\\\\\\"
                    </ul></li>
                    \\\\\\\").\\\\\\\"
    
                </ul></li>
    
            \\\").\\\"
            </ul></li>
    
        \").\"
        </ul></li>
        </li>
        ")."
        </ul>
        </div>

    Вывод меню в главном макете дизайна одного сайта на базе говноCMS Netcat. Можно попроще сделать, но видимо автор торопился ;) И весь этот говнокод редактируется в textarea размерами 700x300px без всякой подсветки.

    guest, 26 Марта 2009

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

    +152.2

    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
    function ShowMsg($text)
    {
        if(session_is_registered('xynta')) $un = base64_decode(strrev($_SESSION['xynta']));
        else $un = "%USERNAME%";
        $text = str_replace("%%USERNAME%%",$un,$text);
        $text = preg_replace("/\[img\](.+?)\[\/img\]/is","<img src=\"\\1\" />",$text);
        $text = preg_replace("/\[bkb\](.+?)\[\/bkb\]/is","<span class=bkb>\\1</span>",$text);
        $text = preg_replace("/\[move\](.+?)\[\/move\]/is","<marquee>\\1</marquee>",$text);
        $text = preg_replace("/\[quote\](.+?)\[\/quote\]/is","<blockquote>\\1</blockquote>",$text);
        $text = preg_replace("/\[center\](.+?)\[\/center\]/is","<center>\\1</center>",$text);
        $text = preg_replace("/\[b\](.+?)\[\/b\]/is","<b>\\1</b>",$text);
        $text = preg_replace("/\[i\](.+?)\[\/i\]/is","<i>\\1</i>",$text);
        $text = preg_replace("/\[u\](.+?)\[\/u\]/is","<u>\\1</u>",$text);
        $text = preg_replace("/\[s\](.+?)\[\/s\]/is","<s>\\1</s>",$text);
        $text = preg_replace("/\[code\](.+?)\[\/code\]/is","<code>\\1</code>",$text);
        $text = preg_replace("/\[effekt\](.+?)\[\/effekt\]/is","<div style='padding: 20px;display:block;'><span id=effekt name=effekt>\\1</span></div>",$text);
        $text = preg_replace("/\[blink\](.+?)\[\/blink\]/is","<span id=blink name=blink>\\1</span>",$text);
        //    $text = preg_replace("/\[flash\](.+?)\[\/flash\]/is","<embed type='application/x-shockwave-flash' width=640 height=480 src=\\1 />",$text);
        $text = preg_replace_callback("/\[mp3\](.+?)\[\/mp3\]/is","mp3_safe_url",$text);
        $text = preg_replace("/\[bg=(.+?)\](.+?)\[\/bg\]/is","<span style='background:\\1'>\\2</span>", $text);
        $text = preg_replace("#\[url\](.+?)\[/url\]#is", "<a href=http://www.dereferer.org/?\\1 target=_blank>\\1</a>", $text);
        if(!strstr($text,"<br")) $text=nl2br($text);
        return $text;
    }

    diio, 15 Апреля 2010

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

    +152.1

    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
    <?php
    
    /*========================ПРОВЕРКА НА ПОЛУЧЕНИЕ АПА/ЛЕВЕЛА=======*/
    
    function testUp($who) {
    
        $data=mysql_fetch_array(mysql_query("SELECT level,exp,next_up,ups,money FROM users WHERE login='$who'"));
        $player_exp=$data["exp"];
        $level=$data["level"];
        $exp_table=array();
        $exp_table[0]="20";
        $exp_table[1]="75";
        $exp_table[2]="190";
        $exp_table[3]="390";
    .........................................................
        $exp_table[95]="37872105";
        $exp_table[96]="65916370";
        $exp_table[97]="121680315";
        $exp_table[98]="232883620";
        $exp_table[99]="454965645";
        $exp_table[100]="454965645";
    
        $stat_table=array();
        $stat_table[0]="4";
        $stat_table[1]="4";
        $stat_table[2]="4";
    ..........................................................
        $stat_table[98]="4";
        $stat_table[99]="4";
        $stat_table[100]="4";
    
        $money_table=array();
        $money_table[0]="2";
        $money_table[1]="2";
        $money_table[2]="6";
        $money_table[3]="12";
    .........................................................
        $money_table[97]="243864";
        $money_table[98]="478660";
        $money_table[99]="946412";
        $money_table[100]="1000000";
    
        $level_table=array();
        $level_table[0]="0";
        $level_table[1]=$exp_table[0];
        $level_table[2]=$exp_table[1];
        $level_table[3]=$exp_table[2];
        $level_table[4]=$exp_table[3];
        $level_table[5]=$exp_table[4];
    ......................................................
        $level_table[98]=$exp_table[97];
        $level_table[99]=$exp_table[98];
        $level_table[100]=$exp_table[99];
        $level_table[101]=$exp_table[100];
    // дальше идет малопонятный код
    ?>

    Делаю доработку браузерной игры от одного умельца.

    dicos, 11 Декабря 2009

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

    +152.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $q = "SELECT COUNT(ID) AS num FROM articles WHERE ID = '$id'";
    
      $res = $this->myconect($q);
      $row = mysql_fetch_array($res);
    
      if($row[num]>0)
          $this->artID = $id;
      else
          $this->artID = $id;

    guest, 09 Апреля 2009

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

    +152.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php
    if(!($str===$str2)) {
    	#ибо !=== не существует (с)Денис Колисниченко - книга "Самоучитель PHP 5"
    }
    ?>

    Не покупайте эту книгу =\

    guest, 14 Января 2009

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

    +152

    1. 1
    Здравствуйте, есть люди которые могут помочь дописать проект до конца, чуть-чуть остался.

    kbatyrbayev, 25 Июня 2015

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

    +152

    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
    $prefix = '[users][claims]';
     eval('$claim_id = $USER[parameters]'.$prefix.'[claim_id]; $claim_id = $claim_id ? toNumber(explode(",", $claim_id)) : array();');
     eval('$type = $USER[parameters]'.$prefix.'[type] ? $USER[parameters]'.$prefix.'[type] : ""; if (!is_array($type)) $type = array();');
     eval('$status = $USER[parameters]'.$prefix.'[status] ? $USER[parameters]'.$prefix.'[status] : array(); if (!is_array($status)) $status = array();');
     eval('$date = $USER[parameters]'.$prefix.'[date];');
     eval('$start_time = $USER[parameters]'.$prefix.'[start_time];');
     eval('$end_time = $USER[parameters]'.$prefix.'[end_time];');
     eval('$start_point = $USER[parameters]'.$prefix.'[start_point]; if (!is_array($start_point)) $start_point = array();');
     eval('$end_point = $USER[parameters]'.$prefix.'[end_point]; if (!is_array($end_point)) $end_point = array();');
     eval('$client_id = $USER[parameters]'.$prefix.'[client_id]; $client_id = "";');
     eval('$passenger_name = $USER[parameters]'.$prefix.'[passenger_name]; if (!is_array($passenger_name)) $passenger_name = array();');
     eval('$airlines = $USER[parameters]'.$prefix.'[airlines]; if (!is_array($airlines)) $airlines = array();');
     eval('$marker = $USER[parameters]'.$prefix.'[marker]; if (!is_array($marker)) $marker = array();');
     eval('$department = $USER[parameters]'.$prefix.'[department]; if (!is_array($department)) $department = array();');
     eval('$show_all = $USER[parameters]'.$prefix.'[show_all];');

    шах и мат аметисты!

    3371, 28 Апреля 2015

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

    +152

    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
    // Наткнулся в коде на
    try
    {
         throw new Provider_Exception($curl_error);
    }
    catch (Exception $e)
    {
          throw new Provider_Exception('No connection');
    }
    
    // и отрефакторил
    try
    {
         throw new Provider_Exception($curl_error);
    }
    catch (Exception $e)
    {
          throw new Provider_Exception($e->getMessage());
    }

    PROFIT!

    invision70, 03 Апреля 2015

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

    +152

    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
    <?
    require_once('ittable.class.php');
    
    class ITForm extends ITTable
    {
    public function __construct($tbl)
    {
    parent::__construct($tbl);
    
    //путь с скрипту который удаляет файлы по tblname record_id filename
    $this->path2deletephp='/itcms4/ckeditor/delete.php';
    }
    
    
    public function printForm($i, $action, $head, $submitvalue='', $captcha=0)
    {
    $form = $this->generateFormData($i, $action, $head, $submitvalue, $captcha);
    
    print "<h1>$form->head</h1>
    $form->begin
    $form->inputhidden
    
    <table>";
    
    foreach($form->inputs as $k=>$v)
     print "<tr id='itforms_$k'" . ($this->columns[$k]->blockclass?' class="' . $this->columns[$k]->blockclass . '"':'') ."><td>$v->name</td><td>$v->input</td></tr>\n";
     
    print "</table>
    
    $form->files
    
    
    <hr><input type='submit' value='$form->submitvalue'></form>
    
    <script type='text/javascript'>
    var itform;
    $(document).ready(function()
      {
       itform = new ITForm($('#$this->tbl$i->id'));
       $form->js
       });
    </script>
    ";
    }
    
    public function insertForm($head, $submitvalue='', $i=0)
    {
     if(!$i)
      $i = new stdClass();
      
     $copy_id = intval($_GET['copy_id']);
     if($copy_id)
     {
      $r=exec_mysql_query("SELECT * FROM $this->tbl WHERE id='$copy_id'");
      $row=mysql_fetch_array($r);
      foreach($row as $k=>$v)
       if(!isset($i->$k))
        $i->$k = $v;
     }
     //чтобы можно было загрузить файлы делаем временный id в диапазоне от 10^7 до 2*10^9
     $i->id = 'r' . rand(10000000, 2000000000);
     $this->printForm($i, 'insert.php', $head, $submitvalue);
    } 
    
    public function updateForm($id, $head, $submitvalue='')
    {
     $this->printForm($this->getObject($id), 'update.php',  $head, $submitvalue);
    
    if(mysql_numrows(exec_mysql_query("SELECT id FROM it_updatelog WHERE tbl='$this->tbl' AND record_id='$id'")))
     print "<a href=/crm2/log/?w_tbl_2=$this->tbl&w_record_id_1=$id>История изменений</a><br>"; 
    }
    
    public function deleteForm($id, $head, $submitvalue='')
    {
     $this->printForm($this->getObject($id), 'delete.php',  $head, $submitvalue);
    }
    
    public function updateForm4Object($o, $head, $submitvalue='')
    {
     $this->printForm($o, 'update.php',  $head, $submitvalue);
    
    if(mysql_numrows(exec_mysql_query("SELECT id FROM it_updatelog WHERE tbl='$this->tbl' AND record_id='$o->id'")))
     print "<a href=/crm2/log/?w_tbl_2=$this->tbl&w_record_id_1=$o->id>История изменений</a><br>"; 
    }

    Продолжение: http://govnokod.ru/17479

    itgovnokod, 19 Января 2015

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

    +152

    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
    98. 98
    <?
    require_once('ittable.class.php');
    
    class ITForm extends ITTable
    {
    public function __construct($tbl)
    {
    parent::__construct($tbl);
    
    //путь с скрипту который удаляет файлы по tblname record_id filename
    $this->path2deletephp='/itcms4/ckeditor/delete.php';
    }
    
    
    public function generateFormData($i, $action, $head, $submitvalue='', $captcha=0)
    {
    global $itcmscfg;
    $form->submitvalue=htmlentities($submitvalue?$submitvalue:$head, ENT_NOQUOTES, 'UTF-8');
    $form->tbl = $this->tbl;
    if($this->files) $enctype='enctype="multipart/form-data"';
    $form->head = htmlentities($head, ENT_NOQUOTES, 'UTF-8');
    $form->begin = "<form  name='$this->tbl$i->id' id='$this->tbl$i->id' action='$action' method='post' $enctype>";
    $form->inputhidden .= "<input type='hidden' name='id' value='$i->id'><input type='hidden' name='referer' value='" . ($_SERVER['HTTP_REFERER']?$_SERVER['HTTP_REFERER']:'./') . "'>\n";
    
    if($action=='delete.php') {$form->disabled = 'disabled'; $OPERATION = UPDATABLE;}
    elseif($action=='insert.php') $OPERATION = INSERTABLE;
    elseif($action=='update.php') $OPERATION = UPDATABLE;
    else $OPERATION = UPDATABLE; 
    
      foreach($this->columns as $field=>$ftype)
      {
       $itforms = " $form->disabled name='$field' id='input-$field'" . $this->getITFormsAttr($field);
       $value = isset($i->$field) ? $i->$field : ($_GET[$field] ? $_GET[$field]: $ftype->Default);
       if(!$ftype->htmlcode) $value = htmlentities($value, ENT_QUOTES, 'UTF-8');
       $itcmscfg->cfgfile = intval($itcmscfg->cfgfile);
       if($ftype->Key=='UNI') $itforms .= " data-async='false' data-unique='{cfgfile:$itcmscfg->cfgfile, tblname:\"$this->tbl\", record_id:\"$i->id\"}'";
       
       if($ftype->visibility & HIDDEN){$form->inputhidden .= "<input type='hidden' $itforms value='$value'>"; continue;}
        
        //если поле не RADONLY, то проверить задан ли regexp и разрешена ли операция
       if( !($ftype->visibility & READONLY) )
        if(!$ftype->pattern || !($ftype->visibility & $OPERATION))
         continue;
       
       $form->inputs[$field]->name = "<label for='input-$field' id='label-$field'>$ftype->outputname</label>"; 
       
       //выводим элементы
       if($ftype->options)
       {
        $form->inputs[$field]->input = $ftype->options->html($field, " $form->disabled " . $this->getITFormsAttr($field), $value);
        if($ftype->options->type==OT_BINARY_CHECKBOX)
         $form->js .= "itform.setCheckboxProperty('$field', 'sum', '$ftype->minselected', '$ftype->maxselected');\n";
       }
       elseif($ftype->inputtype=='wysiwyg')
         $form->inputs[$field]->input = "<script src=/include/ckeditor/ckeditor.js></script>
                                         <textarea class='ckeditor' name='$field'>$value</textarea>";
       elseif($ftype->Type=='text')
        $form->inputs[$field]->input = "<textarea rows='10' cols='80' $itforms " . ($form->disabled?' readonly':'') . ">$value</textarea>";
       elseif($ftype->inputtype)
         $form->inputs[$field]->input = "<input type='$ftype->inputtype' value='$value' $itforms>";
       else
        $form->inputs[$field]->input =  "<input type='text' value='$value' $itforms>";  
    
       $f1 = $ftype->func;
       if(isset($f1))
        $form->inputs[$field]->input .=  (' ' . $f1($value));
    
     }//foreach
    
    
    if($this->files)
    {
     foreach($this->files as $k=>$o)
     {
      $itforms = "";
      //это только для action==insert.php можно, при редактирвоании не обязательно файл заливать
      $itforms .= ($o->required && $action=='insert.php') ? " data-min-length='1'" : '';
      $itforms .= $o->validExtentions ? " data-regexp='$o->validExtentions'" : '';
      if($o->help) $itforms .= " data-help='$o->help'";
      if($o->multiple)
       {
        $itforms .= ' multiple';
        $multiple = '[]';
       }
       else
        $multiple='';
     
      $outputname = htmlentities($o->outputname, ENT_NOQUOTES, 'UTF-8');  
      $form->inputs[$k]->name = "<label for='input-$k'>$outputname</label>";
      $form->inputs[$k]->input = "<input type='file' name='$k$multiple' id='input-$k' $itforms>";
     }//foreach
    
     if(intval($i->id))
      $form->files = $itcmscfg->fs->getFiles4TblRecord($this->tbl, $i->id);
    }//if
    
    return $form;
    }//fun

    itgovnokod, 19 Января 2015

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