1. PHP / Говнокод #6758

    +173

    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
    if(  ( (!empty($HTTP_COOKIE_VARS["lang"])) and ($_POST["lang"] != "") )
    or ( (empty($HTTP_COOKIE_VARS["lang"])) and ($_POST["lang"] != "") ) )
    {
    	setcookie ("lang","",time()+(60*60*24*30),"","");
    	setcookie ("lang",$_POST["lang"],time()+(60*60*24*30),"","");
    	$lang = $_POST[lang];
    }
    
    if ( (empty($HTTP_COOKIE_VARS["lang"])) and (!isset($_POST["lang"])) )
    $lang = $def_language;
    
    if ( (!empty($HTTP_COOKIE_VARS["lang"])) and (!isset($_POST["lang"])) )
    $lang = $HTTP_COOKIE_VARS["lang"];

    Самый ужасный скрипт который встречал когда либо, joker board. и автор просит за него приличную сумму денег! Там код хоть целиком сюда вставляй...

    zigzagkms, 26 Мая 2011

    Комментарии (51)
  2. JavaScript / Говнокод #6757

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    var color2array = function(color){
    	return color.length==4?color.slice(1).split('').map(function(x){return parseInt(x,16)}).concat([255]):
    	       color.length==7?[color.slice(1,3),color.slice(3,5),color.slice(5)].map(function(x){return parseInt(x,16)}).concat([255]):
    		   ~color.indexOf('rgba')?color.slice(5,-1).split(',').map(function(x){return +x}):
    		   ~color.indexOf('rgb')?color.slice(4,-1).split(',').map(function(x){return +x}).concat([255]):[0,0,0,255];
    }

    Один большой костыль преобразующий цвет из вида hex rgb rgba в массив значений от 1 до 255

    art543484, 25 Мая 2011

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

    +107

    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
    if(PlayerInfo[killerid][pMember] != 5 && PlayerInfo[killerid][pLeader] != 5 && PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
           {
           PlayerInfo[killerid][pExp] ++;
           PlayerInfo[killerid][pExp] ++;
           PlayerInfo[killerid][pExp] ++;
           PlayerInfo[playerid][pExp] --;
           PlayerInfo[playerid][pExp] --;
           SendClientMessage(playerid, COLOR_RED, " Ïîòåðÿíî 2 î÷êà îïûòà");
           SendClientMessage(killerid, COLOR_GREEN, " Ïîëó÷åíî 3 î÷êà îïûòà");
           }
           else if(PlayerInfo[killerid][pMember] != 6 && PlayerInfo[killerid][pLeader] != 6 && PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
           {
           PlayerInfo[killerid][pExp] ++;
           PlayerInfo[killerid][pExp] ++;
           PlayerInfo[killerid][pExp] ++;
           PlayerInfo[playerid][pExp] --;
           PlayerInfo[playerid][pExp] --;
           SendClientMessage(playerid, COLOR_RED, " Ïîòåðÿíî 2 î÷êà îïûòà");
           SendClientMessage(killerid, COLOR_GREEN, " Ïîëó÷åíî 3 î÷êà îïûòà");
           }

    fail

    Romanius, 25 Мая 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    class TTestLib
    {
    public:
      char* Name; 
      unsigned int TotalTime; 
    
      TTestLib(char* AName): TotalTime(0), Name(AName) {}
    ...
    }

    char* Name - убило.

    Try, 25 Мая 2011

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

    +147

    1. 1
    memcpy((void*)m_sendBuffer,(void*)jsonString,strlen(jsonString));

    3 ошибки в одной строчке))

    r00t31337, 25 Мая 2011

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

    +153

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    static $table_classes = array (
      0 => 'App',
      1 => 'Plugin',
      2 => 'AppUser',
      3 => 'Contact',
      4 => 'Email',
      5 => 'Link',
      6 => 'Mobile',
      7 => 'Session',
      8 => 'User',
    );

    VASMAN, 25 Мая 2011

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

    +160

    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
    $month = explode(".",$arResult['voting']['DATE_CREATE']);
      $day = $month['0'];
      $yarh = $month['2'];
      $month = $month['1'];
      switch ($month) {
        case 01:
            $monthtext = "января";
            break;
        case 02:
            $monthtext = "февраля";
            break;
        case 03:
            $monthtext = "марта";
            break;
        case 04:
            $monthtext = "апреля";
            break;
        case 05:
            $monthtext = "мая";
            break;
        case 06:
            $monthtext = "июня";
            break;
        case 07:
            $monthtext = "июля";
            break;
        case 08:
            $monthtext = "августа";
            break;
        case 09:
            $monthtext = "сентября";
            break;
        case 10:
            $monthtext = "октября";
            break;
        case 11:
            $monthtext = "ноября";
            break;
        case 12:
            $monthtext = "декабря";
            break;
      }

    Как думаете что произойдет в августе(и последующих месяцах) с таким кодом? :-)

    P.S. $arResult['voting']['DATE_CREATE'] в формате %d.%m.%Y

    develx0, 25 Мая 2011

    Комментарии (82)
  8. Ruby / Говнокод #6751

    −99

    1. 1
    2. 2
    3. 3
    4. 4
    respond_with_error("Lat can't be blank.", :unprocessable_entity) and return if params[:lat].blank?
        respond_with_error("Lon can't be blank.", :unprocessable_entity) and return if params[:lon].blank?
        respond_with_error("Lat is not a number.", :unprocessable_entity) and return if !is_float?(params[:lat])
        respond_with_error("Lon is not a number.", :unprocessable_entity) and return if !is_float?(params[:lon])

    индусский кот от Фет Фрумоса

    sumskyi, 25 Мая 2011

    Комментарии (13)
  9. Ruby / Говнокод #6750

    −95

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    def space(n)
        str = ''
        n.times do
          str += ' '
        end
        str
      end

    whitequark, 25 Мая 2011

    Комментарии (12)
  10. Java / Говнокод #6749

    +77

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    protected String getResponseFaultCode(Map<String, Object> response) {
    		Object faultCode = response.get("FAULTCODE");
    		if (null != faultCode){
    			return faultCode.toString();
    			}	
    		return null;
    	}

    alopen, 25 Мая 2011

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