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

    +175.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    /**
    * Является ли текущее время "летним"
    *
    * @return boolean
    */
    public static function isSummerTime()
    {
       return strtotime('last sunday april 2008') < strtotime('today') && strtotime('last sunday november 2008') > strtotime('today');
    }
    
    /***************************/
    date('I'); уже не в моде?

    Фрицо =) MZZ рулез

    guest, 07 Февраля 2009

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php
    $str = "";
    exec('whoami', $str);
    print_r($str);
    ?>

    Ставили одному индусу кастом билды тикет и црм систем. Собрали пакетики, отдали. Индус пожаловался на предмет "ничего не работает". Смотрю на его вмварю - сервер явный даун. Спрашиваю под каким юзером стартует апач. Чувак открывает консоль, создает файл '/var/www/htdocs/test.php' и пишет этот шедевр

    guest, 07 Февраля 2009

    Комментарии (0)
  3. PHP / Говнокод #508

    +139.9

    1. 1
    $IN=array_merge($_POST, $_GET);   //get overwrite post.

    в одном самописном фреймворке видел.

    guest, 06 Февраля 2009

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

    +174.6

    1. 1
    define('PATH_thisScript',str_replace('//','/', str_replace('\\','/', (php_sapi_name()=='cgi'||php_sapi_name()=='isapi' ||php_sapi_name()=='cgi-fcgi')&&($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? ($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):($_SERVER['ORIG_SCRIPT_FILENAME']?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));

    Typo3...
    О программерах:
    Диагноз: непредсказуемое поведение.
    Следствие: невозможность совершать объективное упроавление.
    Лечение: Изоляция, до тех пока не будет разработана методология по коррекции алгоритмики психики.

    guest, 06 Февраля 2009

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

    +141

    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
    92. 92
    93. 93
    <?php
    
    set_time_limit(0);
    
    while (1) { 
    
    $proxyData = file_get_contents('http://www.freeproxy.ru/download/lists/goodproxy.txt');
    
    
    $matechs = array();
    
    preg_match_all('~\d+\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+)~s', $proxyData, $matechs);
    
    
    foreach ($matechs[1] as $proxy) {
    
    $curl = curl_init();
    
    $str = array(
    
    "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.5) Gecko/2008120122",
    
    "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
    
    "Accept-Language: ru,en-us;q=0.7,en;q=0.3",
    
    "Accept-Encoding: gzip,deflate",
    
    "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7",
    
    "Keep-Alive: 300",
    
    "Connection: keep-alive",
    
    "Cache-Control: max-age=0"
    
    );
    
    curl_setopt($curl, CURLOPT_HTTPHEADER, $str); 
    
    curl_setopt($curl, CURLOPT_REFERER, 'http://bege.php.com.ua/2009/02/05/den-vsex-vlyublyonnyx/');
    
    curl_setopt($curl, CURLOPT_URL, 'http://valentine.magiclands.ru/lovetree/5934547976');
    
    curl_setopt($curl, CURLOPT_PROXY, $proxy);
    
    curl_setopt($curl, CURLOPT_TIMEOUT, 10);
    
    $res = curl_exec($curl);
    
    
    var_dump($res);
    
    
    $curl = curl_init();
    
    $str = array(
    
    "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.5) Gecko/2008120122",
    
    "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
    
    "Accept-Language: ru,en-us;q=0.7,en;q=0.3",
    
    "Accept-Encoding: gzip,deflate",
    
    "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7",
    
    "Keep-Alive: 300",
    
    "Connection: keep-alive",
    
    "Cache-Control: max-age=0"
    
    );
    
    curl_setopt($curl, CURLOPT_HTTPHEADER, $str); 
    
    curl_setopt($curl, CURLOPT_REFERER, 'http://valentine.magiclands.ru/lovetree/5934547976');
    
    curl_setopt($curl, CURLOPT_URL, 'http://valentine.magiclands.ru/lovetree/st/images/5934547976.png?371');
    
    curl_setopt($curl, CURLOPT_PROXY, $proxy);
    
    curl_setopt($curl, CURLOPT_TIMEOUT, 10);
    
    curl_exec($curl);
    
    }
    
    }
    
    ?>

    guest, 06 Февраля 2009

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

    +153.8

    1. 1
    2. 2
    3. 3
    4. 4
    for($i=0;$i<10;$i++){
    			$tf2[rand(0,count($tf2)-1)][2]-=$tf1[rand(0,count($tf1)-1)][1];
    			$tf1[rand(0,count($tf1)-1)][2]-=$tf2[rand(0,count($tf2)-1)][1];
    		}

    Долго не мог понять, что этот кусок делает.

    guest, 04 Февраля 2009

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

    +144

    1. 1
    <?php if ((arg(0) == 'node' and arg(1) != 11) or arg(0) != 'node') { ?>

    Не весь говнокод написан индийцами.. Вот, переделывал тему за беларусом (!). Конечно, все было гавнистое, и тут места не хватило бы на все, но когда увидел это, то посмеялся и начал удалять... =) Процесс, вообщем, пошел.

    guest, 04 Февраля 2009

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

    +165.9

    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
    //Shop-Script PREMIUM  
    
    // -------------------------INITIALIZATION-----------------------------//
    	//include core files
    	include("./cfg/connect.inc.php");
    	include("./includes/database/".DBMS.".php");
    	include("./cfg/language_list.php");
    	include("./core_functions/functions.php");
    	include("./core_functions/category_functions.php");
    	include("./core_functions/cart_functions.php");
    	include("./core_functions/product_functions.php");
    	include("./core_functions/statistic_functions.php");
    	include("./core_functions/reg_fields_functions.php" );
    	include("./core_functions/registration_functions.php" );
    	include("./core_functions/country_functions.php" );
    	include("./core_functions/zone_functions.php" );
    	include("./core_functions/datetime_functions.php" );
    	include("./core_functions/order_status_functions.php" );
    	include("./core_functions/order_functions.php" );
    	include("./core_functions/aux_pages_functions.php" );
    	include("./core_functions/picture_functions.php" ); 
    	include("./core_functions/configurator_functions.php" );
    	include("./core_functions/option_functions.php" );
    	include("./core_functions/search_function.php" );
    	include("./core_functions/discount_functions.php" ); 
    	include("./core_functions/custgroup_functions.php" ); 
    	include("./core_functions/shipping_functions.php" );
    	include("./core_functions/payment_functions.php" );
    	include("./core_functions/tax_function.php" ); 
    	include("./core_functions/currency_functions.php" );
    	include("./core_functions/module_function.php" );
    	include("./core_functions/crypto/crypto_functions.php");
    	include("./core_functions/quick_order_function.php" ); 
    	include("./core_functions/setting_functions.php" );
    	include("./core_functions/subscribers_functions.php" );
    	include("./core_functions/version_function.php" );
    	include("./core_functions/discussion_functions.php" );
    	include("./core_functions/order_amount_functions.php" ); 
    	include("./core_functions/linkexchange_functions.php" ); 
    	include("./core_functions/affiliate_functions.php" );
    
    	include('./classes/xml2array.php');
    	include('./classes/class.virtual.shippingratecalculator.php');
    	include('./classes/class.virtual.paymentmodule.php');
    
    	include('./classes/class.virtual.smsmail.php');
    	include('./modules/smsmail/class.smsnotify.php');
    
    
    	MagicQuotesRuntimeSetting();
    
    	//init Smarty
    	require 'smarty/smarty.class.php';

    500!
    Весь сайт работает только на index.php. И грузит систему это безбожно.
    Взято из Shop-Script PREMIUM.

    guest, 04 Февраля 2009

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

    +215

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <?php
    
    /**
     * Эмулятор GPRS соединения...
     * @todo Убрать на продакшене!!!
     */
    sleep(4);
    //
    
    ...

    Не скажу что это говнокод, но улбынуло =)

    guest, 04 Февраля 2009

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

    +191.7

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    // Везде вижу одно и тоже
    if((isset($_REQUEST['var1'])&&(isset($_REQUEST['var2'])&&(isset($_REQUEST['var1'])&&(isset($_REQUEST['var3']))
    {
     ...
    }
    else
    {
     ...
    }

    bool isset ( mixed $var [, mixed $var [, $... ]] )
    isset($a,$b) и (isset($a))&&(isset($b)) одно и тоже!
    Неужели непонятно?!!
    *WALL*

    guest, 03 Февраля 2009

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