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

    В номинации:
    За время:
  2. Куча / Говнокод #4247

    +134

    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
    <p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>
    	<p class="MsoNormal" align="center" style="text-align: center; margin-left: 10px; margin-right: 5px; margin-top: 0; margin-bottom: 0">&nbsp;</p>

    Гиппер текст! :)
    http://www.uae-embassy.ru/rco01.htm.
    посольство то же...

    Alfred, 14 Сентября 2010

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

    −128

    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
    CREATE TABLE IF NOT EXISTS `ls_user` (
      `user_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
      `user_login` varchar(30) NOT NULL,
      `user_password` varchar(50) NOT NULL,
      `user_mail` varchar(50) NOT NULL,
      `user_skill` float(9,3) unsigned NOT NULL DEFAULT '0.000',
      `user_date_register` datetime NOT NULL,
      `user_date_activate` datetime DEFAULT NULL,
      `user_date_comment_last` datetime DEFAULT NULL,
      `user_ip_register` varchar(20) NOT NULL,
      `user_rating` float(9,3) NOT NULL DEFAULT '0.000',
      `user_count_vote` int(11) unsigned NOT NULL DEFAULT '0',
      `user_activate` tinyint(1) unsigned NOT NULL DEFAULT '0',
      `user_activate_key` varchar(32) DEFAULT NULL,
      `user_profile_name` varchar(50) DEFAULT NULL,
      `user_profile_sex` enum('man','woman','other') NOT NULL DEFAULT 'other',
      `user_profile_country` varchar(30) DEFAULT NULL,
      `user_profile_region` varchar(30) DEFAULT NULL,
      `user_profile_city` varchar(30) DEFAULT NULL,
      `user_profile_birthday` datetime DEFAULT NULL,
      `user_profile_site` varchar(200) DEFAULT NULL,
      `user_profile_site_name` varchar(50) DEFAULT NULL,
      `user_profile_icq` bigint(20) unsigned DEFAULT NULL,
      `user_profile_about` text,
      `user_profile_date` datetime DEFAULT NULL,
      `user_profile_avatar` varchar(250) DEFAULT NULL,
      `user_profile_foto` varchar(250) DEFAULT NULL,
      `user_settings_notice_new_topic` tinyint(1) NOT NULL DEFAULT '1',
      `user_settings_notice_new_comment` tinyint(1) NOT NULL DEFAULT '1',
      `user_settings_notice_new_talk` tinyint(1) NOT NULL DEFAULT '1',
      `user_settings_notice_reply_comment` tinyint(1) NOT NULL DEFAULT '1',
      `user_settings_notice_new_friend` tinyint(1) NOT NULL DEFAULT '1',
      PRIMARY KEY (`user_id`),
      UNIQUE KEY `user_login` (`user_login`),
      UNIQUE KEY `user_mail` (`user_mail`),
      KEY `user_activate_key` (`user_activate_key`),
      KEY `user_activate` (`user_activate`),
      KEY `user_rating` (`user_rating`),
      KEY `user_profile_sex` (`user_profile_sex`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
    [/code]
    очень актуально смотрится эта таблица с приведённой выше. очень умно сделать таблицу "топик-стартер" и не выделить отдельно профиль пользователя. что чаще используется в выборке? =)
    про миллионы пользователей и лайвстрит - не смешите, не верю (с)
    загнётся до прихода в БД

    дополнение к http://govnokod.ru/4203
    выделил отдельным гауно-кодом из-за того, что комично смотрится вместе с указанной выше таблицей. ну и ограничение длины комментов есть. ярые искатели оптимизаций видимо идут мимо. очень актуально смотрится эта таблица с приведённой выше. очень умно сделать таблицу админов в один колумн и не выделить отдельно профиль пользователя. что чаще используется в выборке? =)

    hybroid, 09 Сентября 2010

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

    +144

    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
    <?php
    
    class Event {
        private static $_instance = NULL;
        protected $_events_pool = array();
    
        public static function getInstance() {
            if (self::$_instance === NULL) {
                $class = __CLASS__;
                self::$_instance = new $class;
            }
            
            return self::$_instance;
        }
    
        private function __construct() { }
    
        public function connect($event, $callback, array $params = null) {
            $this->_events_pool[$event] = array(
                'callback'	=>	$callback,
                'params'	=>	$params,
            );
            
            return $this;
        }
    
        public function clear($event = NULL) {
            if ($event === NULL) {
                $this->_events_pool = array();
            } else {
                foreach ($this->_events_pool as $id => $_event) {
                     if ($_event['event'] === $event) {
                        $this->_events_pool[$id] = NULL;
                     }
                }
            }
        }
    
        public function emit($events = NULL) {
            if ($events === NULL) {
                $events = array_keys($this->_events_pool);
            } else {
                $events = (is_array($events)) ? $events : array($events);
            }
            
            foreach ($events as $event) {
                foreach ($this->_events_pool as $id => $item) {
                     if ($id === $event) {
                        $this->call($this->_events_pool[$id]['callback']);
                     }
                }
            }
        }
    
        protected function call($class_name, $method_name = NULL, array $params = array(), array $class_params = array()) {	
            $_method = ($method_name === NULL) ? $class_name : array($class_name, $method_name);
            call_user_func_array($_method, $params);
        }
    }

    nergal, 26 Августа 2010

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

    +175

    1. 1
    2. 2
    sleep(10);
    header('Location: http://example.com');

    Называется "Редирект через 10 секунд".
    Собственно автору требовалось это: <meta http-equiv="refresh" content="10; url=index.php">.

    Uchkuma, 23 Августа 2010

    Комментарии (18)
  6. C# / Говнокод #4027

    +134

    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
    TestIssue = new Issue(Id, ProjectId, ProjectName, Code, Title,  
        Description, CategoryId, CategoryName, PriorityId,
        PriorityName,PriorityImageUrl, StatusId, StatusName, 
        StatusImageUrl, IssueTypeId, IssueTypeName,IssueTypeImageUrl,
        ResolutionId, ResolutionName,ResolutionImageUrl, 
        AssignedDisplayName, AssignedUsername, AssignedUserId,
        CreatorDisplayName, CreatorUsername, CreatorUserId, 
        OwnerDisplayName, OwnerUsername, OwnerUserId, DueDate, 
        MilestoneId, MilestoneName, MilestoneImageUrl, 
        MilestoneDueDate, AffectedMilestoneId, AffectedMilestoneName, 
        AffectedMilestoneImageUrl, Visibility, TimeLogged, Estimation, 
        DateCreated, LastUpdate, LastUpdateUsername, 
        LastUpdateDisplayName, Progress, Disabled, Votes);

    В конструкторе класса Issue 47 аргументов (http://codehelper.ru/questions/156).

    admax, 18 Августа 2010

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

    +171

    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
    <?if ($tip1[1]=="avi"){?>class="lnk-avi"<?}
      elseif ($tip1[1]=="djv"){?>class="lnk-djv"<?}
      elseif ($tip1[1]=="doc"){?>class="lnk-doc"<?}
      elseif ($tip1[1]=="flv"){?>class="lnk-flv"<?}
        elseif ($tip1[1]=="pdf"){?>class="lnk-pdf"<?}
      elseif ($tip1[1]=="jpeg"){?>class="lnk-jpeg"<?}
        elseif ($tip1[1]=="jpg"){?>class="lnk-jpeg"<?}
    	  elseif ($tip1[1]=="JPEG"){?>class="lnk-jpeg"<?}
    	    elseif ($tip1[1]=="JPG"){?>class="lnk-jpeg"<?}
      elseif ($tip1[1]=="pdf"){?>class="lnk-pdf"<?}
      elseif ($tip1[1]=="png"){?>class="lnk-png"<?}
      elseif ($tip1[1]=="swf"){?>class="lnk-swf"<?} 
        elseif ($tip1[1]=="gif"){?>class="lnk-gif"<?}
      elseif ($tip1[1]=="xls"){?>class="lnk-xls"<?}?>
      ><?=$VALUESIO[$i]?></a>, <?=$tip1[1];?>, <?=$size1;?>Мб

    case придумали дураки)

    нашол в проекте, который сейчас доделываю)

    kudin, 16 Августа 2010

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

    +113

    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
    double x, y;
    
    void InitializeComponent()
    {
        this.MouseClick += new MouseEventHandler(Form1_Click);
        this.Paint += new PaintEventHandler(Form1_Paint);
    }
    
    void Form1_Paint(object sender, PaintEventArgs e)
    {
        PointF p = new PointF(0, 0);
        PointF pp = new PointF((float)x, (float)y);
        e.Graphics.DrawPolygon(new Pen(Color.Black, 3), new PointF[2] { p, pp });
    }
    
    void Form1_Click(object sender, MouseEventArgs e)
    {
        x = e.X;
        y = e.Y;
    
        AsyncDraw(ref x, ref y);
    }
    
    void AsyncDraw(ref double x, ref double y)
    {
        x = x;
        y = y;
    }

    sergylens, 14 Августа 2010

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

    +125

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    $result = mysql_query ("UPDATE data SET title='$title', meta_d='$meta_d', meta_k = '$meta_k', date='$date', description='$description', text='$text', author='$author', cat='$cat', mini_img = '$mini_img' WHERE id='$id'");
            
    	if ($result =='true') {echo "<p>Ваша заметка успешно обнавлена!</p>";}
        else  {echo "<p>Ваша заметка не обнавлена!</p>";}  
            }
            
    else
    {
     
     echo "<p>Вы ввели не всю информацию, поэтому заметка в базе не может быть обнавлена</p>";
     
     }

    Опять Попов. После его Код по его видео уроку. Сколько уже говорится что Попов это не учитель это бизнесмен - лохотронщик нет все ровно покупают его диски пишут код от которого уже и не смешно

    Vasiliy, 12 Августа 2010

    Комментарии (18)
  10. C# / Говнокод #3930

    +104

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    int x = 1, z = ++x + x;
    Console.WriteLine (x.ToString () + "  " + z.ToString ());
    x = 1;
    int z1 = x + ++x;
    Console.WriteLine (x.ToString ()  + "  " + z1.ToString ());

    Вот такой код

    Ebaw, 10 Августа 2010

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

    +157

    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
    //проверка привата
    function NewPrivat()
     {
      global $connect, $user, $rid;
      $nup = intval(mysql_result(mysql_query("SELECT COUNT(id) FROM `privmsg_inbox` WHERE `mepl`='0' AND `id_user`='".$user['id']."'", $connect),0));
      if($nup != 0)
      {
       echo '<div class="bar">
             <a href="privmsg.php';
       if ($rid['id']!=0) echo '?idr='.$rid['id'];
       echo '"><b>Новые сообщения: <font color="red">'.$nup.'</font></b></a>
             </div>';
    
      }
      return ;
     }
    
    // ..................
    
    //выщитываем сколько онлайн
    function online()
     {
      global  $user, $connect;
      $time = time();
      $in_on_line = '1500';
      $result_update = mysql_query("DELETE FROM `online` WHERE `unix`+$in_on_line < $time OR `login_id` = '".$user['id']."'", $connect);
      $result_insert = mysql_query("INSERT INTO `online` (`ip`,`unix`, `login`, `login_id`) VALUES ('".IPUSR."','$time', '".$user['nick']."', '".$user['id']."')", $connect);
      $online = mysql_num_rows(mysql_query("SELECT `id` FROM `online` WHERE `login`<>''", $connect));
      return $online;
     }
    
    
    // ..................
    
    //проверка авторизации
    function user()
     {
      global $connect;
      if(isset($_SESSION['login']) and isset($_SESSION['pass']))
       {
        $l = acs($_SESSION['login']);
        $p = acs($_SESSION['pass']);
        $user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `nick`='$l' AND `pass`='$p' ;", $connect));
       }
      elseif (isset($_REQUEST['id']))
       {
        //$id = intval($_REQUEST['id']); 
    	//$user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id`='$id'", $connect));
       } 
      else $user=false; 
      return $user; 
     }
    
    
    function php_decode($in){

    очень удобно создавать вот такие функции когда используются они только один раз в скрипте

    Morgan, 08 Августа 2010

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