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

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

    +140.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
    <?php
    //Данные на базу
    $lnk = mysql_connect('localhost', 'mysql_user', 'mysql_password')
           or die ('Not connected : ' . mysql_error());
    mysql_select_db('primecms_db', $lnk) or die ('Can\'t primecms_db foo : ' . mysql_error());
    
    
    class insert{
    	var $pid, $alias, $text, $position, $status, $create_time, $modify_time;
    }
    
    function con_in($alias, $text_en, $text_ru, $text_descr){
    	$res = new insert;
    	$res->pid=1;
    	$res->alias=addslashes($alias);
    	$res->text='<p>'.addslashes($text_en).'</p>\r\n<p>'.addslashes($text_ru).'</p>\r\n<p>'.addslashes($text_descr).'</p>';
    	$res->position=0;
    	$res->status=1;
    	$res->create_time=time();
    	$res->modify_time=time();
    	return $res;
    }
    
    if ($_POST['send']){
    	$con =  con_in($_POST['alias'],$_POST['text_en'],$_POST['text_ru'],$_POST['text_descr']);
    	mysql_query("INSERT INTO e118_glossary_items (`id`, `pid`, `alias`, `text`, `position`, `status`, `create_time`, `modify_time`) VALUES (".$con->pid.",'".$con->alias."','".$con->text."',".$con->position.",".$con->status.",".$con->create_time.",".$con->modify_time.")");
    }
    ?>
    
    <form name="" action="" method="post">
    Alias<input name="alias" size=30  type="text" value=""><br />
    text_en<input name="text_en" size=30 type="text" value=""><br />
    text_ru<input name="text_ru" size=30  type="text" value=""><br />
    text decr<textarea name="text_descr" rows=7 cols=50 wrap="off"></textarea><br />
    <input type="submit" value="Send" name="send"><br />
    </form>

    не забываем править
    //Данные на базу

    guest, 04 Марта 2009

    Комментарии (1)
  3. JavaScript / Говнокод #656

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    script language="Javascript" type="text/javascript">
          function GetActivePoll()
          {
            var tmp =1;
            if (tmp == 1)
            {
             ...
            }
          }

    С одного известного сайта...

    guest, 04 Марта 2009

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

    +154.7

    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
    function ruslat ($string) # Задаём функцию перекодировки кириллицы в транслит.
    {
    $string = ereg_replace("ж","zh",$string);
    $string = ereg_replace("ё","yo",$string);
    $string = ereg_replace("й","i",$string);
    $string = ereg_replace("ю","yu",$string);
    $string = ereg_replace("ь","'",$string);
    $string = ereg_replace("ч","ch",$string);
    $string = ereg_replace("щ","sh",$string);
    $string = ereg_replace("ц","c",$string);
    $string = ereg_replace("у","u",$string);
    $string = ereg_replace("к","k",$string);
    $string = ereg_replace("е","e",$string);
    $string = ereg_replace("н","n",$string);
    $string = ereg_replace("г","g",$string);
    $string = ereg_replace("ш","sh",$string);
    $string = ereg_replace("з","z",$string);
    $string = ereg_replace("х","h",$string);
    $string = ereg_replace("ъ","''",$string);
    $string = ereg_replace("ф","f",$string);
    $string = ereg_replace("ы","y",$string);
    $string = ereg_replace("в","v",$string);
    $string = ereg_replace("а","a",$string);
    $string = ereg_replace("п","p",$string);
    $string = ereg_replace("р","r",$string);
    $string = ereg_replace("о","o",$string);
    $string = ereg_replace("л","l",$string);
    $string = ereg_replace("д","d",$string);
    $string = ereg_replace("э","yе",$string);
    $string = ereg_replace("я","jа",$string);
    $string = ereg_replace("с","s",$string);
    $string = ereg_replace("м","m",$string);
    $string = ereg_replace("и","i",$string);
    $string = ereg_replace("т","t",$string);
    $string = ereg_replace("б","b",$string);
    $string = ereg_replace("Ё","yo",$string);
    $string = ereg_replace("Й","I",$string);
    $string = ereg_replace("Ю","YU",$string);
    $string = ereg_replace("Ч","CH",$string);
    $string = ereg_replace("Ь","'",$string);
    $string = ereg_replace("Щ","SH'",$string);
    $string = ereg_replace("Ц","C",$string);
    $string = ereg_replace("У","U",$string);
    $string = ereg_replace("К","K",$string);
    $string = ereg_replace("Е","E",$string);
    $string = ereg_replace("Н","N",$string);
    $string = ereg_replace("Г","G",$string);
    $string = ereg_replace("Ш","SH",$string);
    $string = ereg_replace("З","Z",$string);
    $string = ereg_replace("Х","H",$string);
    $string = ereg_replace("Ъ","''",$string);
    $string = ereg_replace("Ф","F",$string);
    $string = ereg_replace("Ы","Y",$string);
    $string = ereg_replace("В","V",$string);
    $string = ereg_replace("А","A",$string);
    $string = ereg_replace("П","P",$string);
    $string = ereg_replace("Р","R",$string);
    $string = ereg_replace("О","O",$string);
    $string = ereg_replace("Л","L",$string);
    $string = ereg_replace("Д","D",$string);
    $string = ereg_replace("Ж","Zh",$string);
    $string = ereg_replace("Э","Ye",$string);
    $string = ereg_replace("Я","Ja",$string);
    $string = ereg_replace("С","S",$string);
    $string = ereg_replace("М","M",$string);
    $string = ereg_replace("И","I",$string);
    $string = ereg_replace("Т","T",$string);
    $string = ereg_replace("Б","B",$string); 
    return $string;
    }

    Privat Dle Graber 8, я под столом, strtr нынче не в моде, хотя весь скрипт один сплошной говнокод.

    guest, 04 Марта 2009

    Комментарии (1)
  5. JavaScript / Говнокод #651

    +136.9

    1. 1
    selonChange = this.onchange.toString().split("{")[1].split("}")[0];

    вот такая вот херня

    guest, 03 Марта 2009

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

    +150

    1. 1
    2. 2
    3. 3
    if (is_null($a)) return 'null';
    if ($a === false) return 'false';
    if ($a === true) return 'true';

    Не делайте так. Есть is_bool(), is_null(), or в конце концов.

    guest, 02 Марта 2009

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

    +142

    1. 1
    2. 2
    3. 3
    <?php
    eval("echo 'Hello, world!'");
    ?>

    гомно =)

    guest, 01 Марта 2009

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

    +156.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php
    define('FLAG', true);
    /*немного другого кода*/
    while(FLAG){ if(FLAG===true && FLAG!==false) break; }
    ?>

    Ну это надо же!!!
    Зачем так писать?

    guest, 01 Марта 2009

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

    +149

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    //Iterate through temp array to complete the catpath of all categories
        $ready = false;
        while ($ready == false) {
          $ready = true;
          .....
              } else {
                $ready = false;
              }
            }

    А как вам такое?

    guest, 28 Февраля 2009

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

    +165.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    foreach($data as $k=>$v)
    {
       if(!isset($data[$k]))
       {
          $data[$k] = $v;
       }
    }

    guest, 28 Февраля 2009

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

    +154

    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
    function query_safe()
    	{
    		$time_before = $this->get_real_time();
    
    		if(!$this->connected) $this->connect(DBUSER, DBPASS, DBNAME, DBHOST);
    		
    		$args = func_get_args();
            $tmpl =& $args[0];
            $tmpl = str_replace("%", "%%", $tmpl);
            $tmpl = str_replace("?", "%s", $tmpl);
            foreach ($args as $i=>$v) {
                if(!$i) continue;
                if(is_int($v)) continue;
                $args[$i] = "'".mysql_escape_string($v)."'";
            }
            for($i=$c=count($args)-1; $i<$c+20; $i++)
                $args[$i+1] = "UNKNOWN_SQL_COMMAND_$i";
            
            $sql = call_user_func_array("sprintf", $args);
            //echo $sql;
            exit;
            
    		if(!($this->query_id = mysql_query($sql, $this->db_id) )) {
    
    			$this->mysql_error = mysql_error();
    			$this->mysql_error_num = mysql_errno();
    			if($show_error) {
    				$this->display_error($this->mysql_error, $this->mysql_error_num, $query);
    			}
    		}
    		
    		$this->MySQL_time_taken += $this->get_real_time() - $time_before;
    		$this->query_num ++;
    		return $this->query_id;
    	}

    Что же тут творится?? :)))

    guest, 26 Февраля 2009

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