1. Pascal / Говнокод #7869

    +146

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    var
      WS1, WS2, WS3: TWSocket;
    ...
    begin
    ...
    WS1 := TWSocket.Create(Self);
    WS2 := TWSocket.Create(Self);
    WS3 := TWSocket.Create(Self);
    ...
    end;

    и это гавно код

    Xxx_Guf_xxX, 14 Сентября 2011

    Комментарии (15)
  2. Pascal / Говнокод #7868

    +146

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    var
      WS: array[1..3] of TWSocket;
    ...
    var
      I: Integer;
    begin
    ...
      for I := 1 to 3 do
        WS := TWSocket.Create(Self);
    ...
    end;

    Гавно код так считают

    Xxx_Guf_xxX, 14 Сентября 2011

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

    +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
    char *f(char *s1, ...)
    { char **cp = &s1;            //--адрес первого указателя
       int len = 0;        
       // цикл для определения общей длины сцепляемых строк
       while (*cp) { len += strlen(*cp); cp++; }                          
      char *s = new char[len+1];       //--память для строки
      s[0]=0;                       //-- "очищаем" строку
    // цикл для сцепления строк
      cp=&s1;                       //-- опять установка на 1-й параметр
      while (*cp) 
      {  strcat(s, *cp);             //-- прицепляем первую (и следующие)
         cp++;                       //-- перемещаемся на следующую
      }         
      return s;
    }

    Сцепление строк (ноль в конце)
    http://www.rsdn.ru/forum/cpp/418970.1.aspx

    rat4, 14 Сентября 2011

    Комментарии (238)
  4. Python / Говнокод #7866

    −179

    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
    def mac_search(*args):
        db = MySQLdb.connect(host="localhost",user="test",passwd="test",db="test")
        cursor = db.cursor()
        cursor.execute('SELECT * FROM ip_groups WHERE mac="%s" AND is_deleted=0;' %args[0].split()[0])
        for j in cursor.fetchall():
            cursor.execute("SELECT * FROM iptraffic_service_links WHERE ip_group_id=%s and is_deleted=0;" %j[1])
            for j1 in cursor.fetchall():
                cursor.execute("SELECT * FROM service_links WHERE id=%s AND is_deleted=0;" %j1[0])
                for j2 in cursor.fetchall():
                    cursor.execute("SELECT * FROM accounts WHERE is_deleted=0 AND id=%s AND is_blocked=0;" %j2[2])
                    for j3 in cursor.fetchall():
                        cursor.execute("SELECT * FROM service_links WHERE account_id=%s AND is_deleted=0;" %j2[2])
                        for j4 in cursor.fetchall():
                            if j4[3]==465 or j4[3]==641:
                                cursor.execute("SELECT * FROM s_multicast WHERE service_id=%s AND %s>=ip_start AND %s<=ip_end;" %(j4[3],args[0].split()[1],args[0].split()[1]))
                                for j5 in cursor.fetchall():
                                    return j5

    Я конечно понимаю, таким уже не удивить. Но все же.

    http://www.python.su/forum/viewtopic.php?pid=76855

    cutwater, 14 Сентября 2011

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

    +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
    16. 16
    17. 17
    18. 18
    /****************Попытка №1:**************/
    <?php
     if(date('d/m') == '13/09')
     echo 'З Днем Програміста!'
    ?>
    
    /****************Попытка №2:**************/
    
    <?php
    if((date('d/m') == '13/09') && (date('L') == 0)){
     echo 'З Днем Програміста!';
     }elseif((date('d/m') == '12/09') && (date('L') == 1)){
     echo 'З Днем Програміста!!!';
     }
    ?>
    
    /****************Попытка №3:**************/
    if (date('z') == 255) echo 'З Днем Програміста!';

    мда... эволюция кода и кодера )

    swordfil, 14 Сентября 2011

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

    +168

    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
    <?php
    	function isValidCharacters($str)
    	{
    		$str2 = preg_replace("[^a-zA-Zа-яА-Я[email protected]]","",$str);
    		if ($str != $str2) return FALSE;
    		return TRUE;
    	}
    	$nik=preg_replace("[^a-zA-Zа-яА-Я[email protected]]","",$_POST['nik']);
    	$pass=preg_replace("[^a-zA-Zа-яА-Я[email protected]]","",$_POST['pass']);
    	if (!isValidCharacters($nik) || !isValidCharacters($pass))
    	{
    		$_SESSION['auth']="error";
    		$_SESSION['error_mes']="Неверный логин или пароль";
    		header('Location: ./index.php');
    		exit();
    	}
    
    //дальше проверка на совпадение логина\пароля, ничего интересного.
    ?>

    Строка 10, после 8-9, типа "А вдруг?!"

    mr.The, 14 Сентября 2011

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function Hehe ($s) {
        $str = $s;
        $str = preg_replace ("/\\\/","", $str);
        $str = preg_replace ("/'/","&#39", $str);
        $str = preg_replace ("/\n/","<br>", $str);
        $str = preg_replace ("/\r/","", $str);
        return $str;
    }

    Название функции оригинальное. Лежала в модуле ~5k строк.

    Enjoy, 14 Сентября 2011

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $name = $data->fields["name"];             
    $name = str_replace("\n","",$name);
    $name = str_replace("\r","",$name);
    $name = str_replace("\\","\\\\",$name);
    $name = preg_replace("/'/","&#39",str_replace("\n","",str_replace("\"",""",$name)));

    2, 3 и 4 строчки похожи на серию ударов по мозгу, а последняя на кровавое комбо :)

    Enjoy, 14 Сентября 2011

    Комментарии (22)
  9. Java / Говнокод #7861

    +93

    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
    <%if(myaccount.getCountry().equals( "AF" )){%> <font color="grey"><label for="country">Afghanistan</label></font>
        	<%}else if(myaccount.getCountry().equals( "AL" )){%> <font color="grey"><label for="country">Albania</label></font>
        	<%}else if(myaccount.getCountry().equals( "DZ" )){%> <font color="grey"><label for="country">Algeria</label></font>
        	<%}else if(myaccount.getCountry().equals( "AS" )){%> <font color="grey"><label for="country">American Samoa</label></font>
        	<%}else if(myaccount.getCountry().equals( "AD" )){%> <font color="grey"><label for="country">Andorra</label></font>
        	<%}else if(myaccount.getCountry().equals( "AO" )){%> <font color="grey"><label for="country">Angola</label></font>
        	<%}else if(myaccount.getCountry().equals( "AI" )){%> <font color="grey"><label for="country">Anguilla</label></font>
        	<%}else if(myaccount.getCountry().equals( "AQ" )){%> <font color="grey"><label for="country">Antarctica</label></font>
        	<%}else if(myaccount.getCountry().equals( "AG" )){%> <font color="grey"><label for="country">Antigua and Barbuda</label></font>
        	<%}else if(myaccount.getCountry().equals( "AR" )){%> <font color="grey"><label for="country">Argentina</label></font>
        	<%}else if(myaccount.getCountry().equals( "AM" )){%> <font color="grey"><label for="country">Armenia</label></font>
        	<%}else if(myaccount.getCountry().equals( "AW" )){%> <font color="grey"><label for="country">Aruba</label></font>
        	<%}else if(myaccount.getCountry().equals( "AU" )){%> <font color="grey"><label for="country">Australia</label></font>
        	<%}else if(myaccount.getCountry().equals( "AT" )){%> <font color="grey"><label for="country">Austria</label></font>
        	<%}else if(myaccount.getCountry().equals( "AZ" )){%> <font color="grey"><label for="country">Azerbaijan</label></font>
        	<%}else if(myaccount.getCountry().equals( "BS" )){%> <font color="grey"><label for="country">Bahamas</label></font>
            <%}else if ...

    Индусская проверка принадлежности аккаунта к определённой стране...

    P.S. Всё не влезло - стран у нас много =)

    vetal, 14 Сентября 2011

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

    +40

    1. 1
    2. 2
    3. 3
    4. 4
    function del_reiting_type($typeid){
    	global $typeid;
    .....
    }

    как-то так...

    brainstorm, 14 Сентября 2011

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