1. Список говнокодов пользователя hdkeeper

    Всего: 16

  2. PHP / Говнокод #5424

    +164

    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
    $proArray = array();
    while(strlen($result))
    {
    	// name
    	$keypos= strpos($result,'=') ;
    	$keyval = substr($result,0,$keypos);
    	// value
    	$valuepos = strpos($result,'&') ? strpos($result,'&') : strlen($result);
    	$valval = substr($result,$keypos+1,$valuepos-$keypos-1);
    	// decoding the respose
    	$proArray[$keyval] = $valval;
    	$result = substr($result,$valuepos+1,strlen($result));
    }

    Разбор URL-encoded ответа от платёжной системы.
    Знал ли автор про функцию parse_str() ?

    hdkeeper, 28 Января 2011

    Комментарии (27)
  3. Perl / Говнокод #4421

    −120

    1. 1
    print qq(<div id="Layer26" class="blank" style="left:170mm; top:96mm; width:95mm;">$base1[17]);

    Верстаем в миллиметрах, используем магические числа и т.п.

    hdkeeper, 22 Октября 2010

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

    +159

    1. 1
    <a href="<?=$res["URL"]?>" style="font-size: <?=$res["FONT_SIZE"]?>px; color: #<?=$res["COLOR"]?>;px" rel="nofollow"><?=$res["NAME"]?></a>

    Битрикс, компонент "Облако тэгов"
    Последний "px" в тэге style явно лишний.

    hdkeeper, 22 Октября 2010

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

    +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
    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
    function func()
      	{
    		$func = array(
    			"*3jd9asl4ksh8kl" => "Core::psUser->updateSelf",
    			"*9dkvls3kfrj54a" => "Core::psUser->setPassword",
    			"*3lso35ne9d0kek" => "Core::psUser->login",
    			"*487fj409z91dkv" => "Core::psUser->register_step1",			
    			"*ns252lo3a8ps11" => "Core::psUser->register_step2",
    			"*ale93kvnwo4pdz" => "Core::psUser->closeRequest",
    			"*ble93kv1wo4pdz" => "Core::psUser->checkEmail",
    			"*wpv48k9k2054k1" => "Core::psUser->recover",
    			"*3lsd8cjfdl3mdk" => "Core::Exchange->startExchange",
    			"*42sd9cjfd24mdk" => "Core::Exchange->startExchangeNew",
    			"*53se9cjfd35mdk" => "Core::Exchange->ExchangeStep2",
    			"*64se0cjfd46mdk" => "Core::Exchange->ExchangeStep3",
    			"*4164-4622-1270" => "Core::Exchange->dest1",
    			"*8273-7121-7643" => "Core::Exchange->dest2",
    			"*8710-4879-0216" => "Core::Exchange->dest3",
    			"*5566-0506-6230" => "Core::Exchange->dest4",
    			"*0635-1830-1345" => "Core::Exchange->dest5",
    			"*3265-0565-4871" => "Core::Exchange->dest6",
    			"*0914-1921-7194" => "Core::Exchange->dest7",
    			"*8126-3901-3136" => "Core::Exchange->dest8",
    			"*2711-0035-9992" => "Core::Exchange->dest9",
    			"*2846-4302-4032" => "Core::Exchange->dest10",
    			"*3879-1991-4154" => "Core::Exchange->dest11",
    			"*8557-5244-6506" => "Core::Exchange->dest12",
    			"*9455-7047-8778" => "Core::Exchange->dest13",
    			"*7329-2394-7939" => "Core::Exchange->dest14",
    			"*4168-0400-0156" => "Core::Exchange->dest15",
    			"*4672-6100-6653" => "Core::Exchange->dest16",
    			"*4930-5681-4263" => "Core::Exchange->dest17",
    			"*2028-3904-4406" => "Core::Exchange->dest18",
    			"*3344-7461-9263" => "Core::Exchange->dest19",
    			"*9282-3030-8891" => "Core::Exchange->dest20",
    			"*8198-3749-8009" => "Core::Exchange->dest21",
    			"*7254-2894-6243" => "Core::Exchange->dest22",
    			"*7969-8488-0540" => "Core::Exchange->dest23",
    			"*0202-7596-3531" => "Core::Exchange->dest24",
    			"*3321-4063-6580" => "Core::Exchange->dest25",
    			"*8319-8427-1264" => "Core::Exchange->dest26",
    			"*9606-3792-8045" => "Core::Exchange->dest27",
    			"*0242-6362-5886" => "Core::Exchange->dest28",
    			"*9362-4435-1538" => "Core::Exchange->dest29",
    			"*9332-4235-1337" => "Core::Exchange->dest30",
    			"*5362-2352-1350" => "Core::Exchange->dest31",
    			"*3262-4356-1670" => "Core::Exchange->dest32",
    			"*4562-4786-9440" => "Core::Exchange->dest33",
    			"*3222-3454-1430" => "Core::Exchange->dest34",
    			"*6573-3226-5683" => "Core::Exchange->dest35",
    			"*6543-9807-2573" => "Core::Exchange->dest36",
    			"*3455-7639-6268" => "Core::Exchange->dest37",
    			"*4523-6563-0978" => "Core::Exchange->dest38",
    			"*3485-7339-6298" => "Core::Exchange->dest39",
    			"*3489-8339-6238" => "Core::Exchange->dest40",
    			"*5485-9339-6295" => "Core::Exchange->dest41",
    			"*3445-7369-6248" => "Core::Exchange->dest42",
    			"*3945-7769-3248" => "Core::Exchange->dest43",
    			"*5945-7369-3568" => "Core::Exchange->dest44",
    			"*8945-7769-3868" => "Core::Exchange->dest45",
    			"*5948-1369-3578" => "Core::Exchange->dest46",			
    			"*9362-4435-1539" => "Core::Order->setStatusByUser",
    			"*9864-4532-2579" => "Core::Feedback->saveFeedback"
    		);
    		return $func;
    	}

    Передача action'а с обфускацией.

    hdkeeper, 10 Июня 2010

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

    +167.6

    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
    <?php
    function daybefore($j){
    $day = date('d');
    $month = date('m');
    $year = date('Y');
    for ($i=0; $i<$j; $i++) { 
    if ($day==1) {
        if ($month == 1) {
            $day = 31;
            $month = 12;
            $year = $year - 1;
        } else {
            $month = $month - 1; 
            switch ($month) {
                case 01:
                    $maxdays=31;
                    break;
                case 02:
                    $a = $year / 4;
                    $b = ceil($a);
                    if ($a==$b){                
                         $maxdays=29;
                    } else {
                          $maxdays=28;
                    }
                    break;
                case 03:
                    $maxdays=31;
                    break;
                case 04:
                    $maxdays=30;
                    break;
                case 05:
                    $maxdays=31;
                    break;
                case 06:
                    $maxdays=30;
                    break;
                case 07:
                    $maxdays=31;
                    break;
                case 08:
                    $maxdays=31;
                    break;
                case 09:
                    $maxdays=30;
                    break;
                case 10:
                    $maxdays=31;
                    break;
                case 11:
                    $maxdays=30;
                    break;
                case 12:
                    $maxdays=31;
                    break;
            }
            $day = $maxdays;
            $year = $year;
        }
    } else {
        $day = $day - 1;
        $month = $month;
        $year = $year;
    }}
    return "$year-$month-$day";
    }
    echo daybefore(3);
    ?>

    Отсюда:
    http://php.net/manual/en/function.date.php

    hdkeeper, 17 Марта 2010

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

    +147.2

    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
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    if(!empty($_POST))
    {
    $url = trim($_POST['url']);
    if((substr($url, 0, 7)) == "http://") $url = str_replace('http://','',$url);
    if((substr($url, 0, 4)) == "www.") $url = str_replace('www.','',$url);
    if(strpos($url,'/')>0) list($url) = explode('/',$url);
    
    $domain = array(
    array("ac","whois.nic.ac","No match"),
    array("ac.cn","whois.cnnic.net.cn","no matching record"),
    array("ac.jp","whois.nic.ad.jp","No match"),
    array("ac.uk","whois.ja.net","No such domain"),
    array("ad.jp","whois.nic.ad.jp","No match"),
    array("adm.br","whois.nic.br","No match"),
    array("adv.br","whois.nic.br","No match"),
    array("aero","whois.information.aero","is available"),
    array("ag","whois.nic.ag","Not found"),
    array("agr.br","whois.nic.br","No match"),
    array("ah.cn","whois.cnnic.net.cn","No entries found"),
    array("al","whois.ripe.net","No entries found"),
    array("am","whois.amnic.net","No match"),
    array("am.br","whois.nic.br","No match"),
    array("arq.br","whois.nic.br","No match"),
    array("at","whois.nic.at","nothing found"),
    array("au","whois.aunic.net","No Data Found"),
    array("art.br","whois.nic.br","No match"),
    array("as","whois.nic.as","Domain Not Found"),
    array("asn.au","whois.aunic.net","No Data Found"),
    array("ato.br","whois.nic.br","No match"),
    array("av.tr","whois.nic.tr","Not found in database"),
    array("az","whois.ripe.net","no entries found"),
    array("ba","whois.ripe.net","No match for"),
    array("be","whois.geektools.com","No such domain"),
    array("bg","whois.digsys.bg","does not exist"),
    array("bio.br","whois.nic.br","No match"),
    array("biz","whois.biz","Not found"),
    array("biz.tr","whois.nic.tr","Not found in database"),
    array("bj.cn","whois.cnnic.net.cn","No entries found"),
    array("bel.tr","whois.nic.tr","Not found in database"),
    array("bmd.br","whois.nic.br","No match"),
    array("br","whois.registro.br","No match"),
    array("by","whois.ripe.net","no entries found"),
    array("ca","whois.cira.ca","Status: AVAIL"),
    array("cc","whois.nic.cc","No match"),
    array("cd","whois.cd","No match"),
    array("ch","whois.nic.ch","We do not have an entry"),
    array("cim.br","whois.nic.br","No match"),
    array("ck","whois.ck-nic.org.ck","No entries found"),
    array("cl","whois.nic.cl","no existe"),
    array("cn","whois.cnnic.net.cn","No entries found"),
    array("cng.br","whois.nic.br","No match"),
    // ...
    // Поскипана ещё куча таких же строк
    );
    
    $end = substr($url, strpos($url, ".") + 1);
    
    for($i = 0; $i < count($domain); $i++)
    {
    if($domain[$i][0] == $end)
    {
    
    $whois = $domain[$i][1];
    $no_found = $domain[$i][2];
    
    break;
    }
    }
    
    if(empty($whois)) exit("Нет данных по этому домену");
    
    @$fp = fsockopen($whois, 43) or exit ("Ошибка при обращении к серверу"); 
    
    fputs($fp, "$url\r\n");
    
    $answer = "";
    
    while(!feof($fp))
    {
    $answer .= "<tr><td>".fgets($fp,128)."</tr></td>";
    }
    
    fclose($fp);
    
    $answer = preg_replace("/".$no_found."/is", "Домен не найден.", $answer);
    
    echo "<h2>Информация о $url</h2>";
    echo "<table width=80%>";
    echo $answer;
    echo "</table>";
    }

    Кто первый разберется тот красавец)
    Отсюда: http://forum.wec.ru/index.php?showtopic=109033

    hdkeeper, 08 Марта 2010

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