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

    +1

    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
    if (!$_pwd_trusted && $resto && $has_image && BOARD_DIR === 'g' && strpos($_thread_sub, '/aicg/') !== false) {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_aicg', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            error(S_IPRANGE_BLOCKED_IMG . ' ' . S_IPRANGE_BLOCKED_TEMP . S_IPRANGE_BLOCKED_L1);
          }
          
          if (!$_pwd_trusted && $resto && $has_image && BOARD_DIR === 'vg' && strpos($_thread_com, '/lolg/') !== false) {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_lolg', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            error(S_IPRANGE_BLOCKED_IMG . ' ' . S_IPRANGE_BLOCKED_TEMP . S_IPRANGE_BLOCKED_L1);
            //show_post_successful_fake($resto);
            //return;
          }
          
          if (!$_pwd_trusted && $resto && $has_image && BOARD_DIR === 'vg' && strpos($_thread_com, '/overwatch') !== false) {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_owg', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            error(S_IPRANGE_BLOCKED_IMG . ' ' . S_IPRANGE_BLOCKED_TEMP . S_IPRANGE_BLOCKED_L1);
            //show_post_successful_fake($resto);
            //return;
          }
          
          if (false && !$_pwd_trusted && $resto && $has_image && BOARD_DIR === 'fa' && strpos($_thread_sub, 'Workwear General') !== false) {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_denim', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            error(S_IPRANGE_BLOCKED_IMG . ' ' . S_IPRANGE_BLOCKED_TEMP . S_IPRANGE_BLOCKED_L1);
            //show_post_successful_fake($resto);
            //return;
          }
          
          if (!$_pwd_known && $resto && $has_image && BOARD_DIR === 'vg' && strpos($_thread_sub, '/bag/') !== false && $browser_id === '04d2237a2') {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_bag', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            error(S_IPRANGE_BLOCKED_IMG . ' ' . S_IPRANGE_BLOCKED_TEMP . S_IPRANGE_BLOCKED_L1);
          }
          
          if (false && !$_pwd_known && !$resto && (BOARD_DIR === 'co' || BOARD_DIR === 'a') && $country !== 'XX' && $browser_id === '02b99990d' && ($country == 'GB' || $country == 'DE' || $country == 'AU' || strpos($_COOKIE['_tcs'], $_SERVER['HTTP_X_TIMEZONE']) === false)) {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_peridot', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            error(S_IPRANGE_BLOCKED_IMG . ' ' . S_IPRANGE_BLOCKED_TEMP . S_IPRANGE_BLOCKED_L1);
          }
          
          if (!$_pwd_trusted && $resto && $has_image && BOARD_DIR === 'vg' && strpos($_thread_sub, 'granblue') !== false) {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_gbfg', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            error(S_IPRANGE_BLOCKED_IMG . ' ' . S_IPRANGE_BLOCKED_TEMP . S_IPRANGE_BLOCKED_L1);
            //show_post_successful_fake($resto);
            //return;
          }
          
          if (!$_pwd_known && $resto && $has_image && BOARD_DIR === 'v' && strpos($_thread_sub, 'gamesdonequick') !== false && $_threat_score >= 0.09 && mt_rand(0, 9) >= 1) {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_adgq', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            show_post_successful_fake($resto);
            return;
          }
          
          if (!$_pwd_known && $resto && $has_image && BOARD_DIR === 'vg' && strpos($_thread_sub, '/zzz/') !== false && $_threat_score >= 0.09 && mt_rand(0, 9) >= 1) {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_zzz', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            show_post_successful_fake($resto);
            return;
          }
          
          if (!$_pwd_verified && $resto && $has_image && BOARD_DIR === 'vg' && strpos($_thread_sub, '/funkg/') !== false && $_threat_score >= 0.09) {
            $_bot_headers = spam_filter_format_http_headers($com, $country, "$insfile$ext", $_threat_score, $_req_sig);
            log_spam_filter_trigger('block_funkg', BOARD_DIR, $resto, $host, 1, $_bot_headers);
            show_post_successful_fake($resto);
            return;
          }

    4chan.org. Хардкод бан. Продолжение https://govnokod.ru/29122.

    Админы, берите на заметку на свои форумы.

    trusted, known это проверки на число постов, связанных с куки+айпи.

    lemur, 22 Апреля 2025

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

    +1

    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
    $css .= '<link rel="stylesheet" href="' . STATIC_SERVER . 'css/' . $mobilecss . '">';
    	
      // April 2024
      $css .= '<link rel="stylesheet" href="' . STATIC_SERVER . 'css/xa24extra.css">';
      
    	if (SHOW_COUNTRY_FLAGS) {
    		$css .= '<link rel="stylesheet" href="' . STATIC_SERVER . 'css/flags.' . CSS_VERSION_FLAGS . '.css">';
    	}
      
      if (ENABLE_BOARD_FLAGS) {
        $_flags_type = (defined('BOARD_FLAGS_TYPE') && BOARD_FLAGS_TYPE) ? BOARD_FLAGS_TYPE : BOARD_DIR;
        $css .= '<link rel="stylesheet" href="' . STATIC_SERVER . 'image/flags/' . $_flags_type . '/flags.' . CSS_VERSION_BOARD_FLAGS . '.css">';
      }
      
    	if( CODE_TAGS ) {
    		$css .= '<link rel="stylesheet" href="' . STATIC_SERVER . 'js/prettify/prettify.' . CSS_VERSION . '.css">';
    	}
    
    	// Various optional tags
    	if( USE_RSS == 1 ) {
    		$rss = '<link rel="alternate" title="RSS feed" href="/' . BOARD_DIR . '/index.rss" type="application/rss+xml">';
    	}
    
    	if( RTA == 1 ) {
    		$rta = '<meta name="rating" content="adult">';
    	}
    
    	if( defined( 'FAVICON' ) ) {
    		$favicon = '<link rel="shortcut icon" href="' . FAVICON . '">';
    	}
    	
    	$thread_unique_ips = 0;
    	$jsUniqueIps = '';
    	
    	if (SHOW_THREAD_UNIQUES) {
        if ($res) {
          $thread_unique_ips = get_unique_ip_count($res);
        }
        
        if ($thread_unique_ips) {
          $jsUniqueIps = 'var unique_ips = ' . $thread_unique_ips . ';';
        }
    	}
      
    	// js tags
    	$jsVersion   = TEST_BOARD ? JS_VERSION_TEST : JS_VERSION;
    	$comLen      = MAX_COM_CHARS;
    	$styleGroup  = style_group();
    	$maxFilesize = MAX_KB * 1024;
    	$maxLines    = MAX_LINES;
    	$jsCooldowns = json_encode(array(
    		'thread' => RENZOKU3,
    		'reply' => RENZOKU,
    		'image' => RENZOKU2
    	));
      
    	$tailSizeJs = '';
    	
      if ($res) {
        $tailSize = get_json_tail_size($res);
        
        if ($tailSize) {
          $tailSizeJs = ",tailSize = $tailSize";
        }
      }

    «Форчан» поломали.

    ISO, 15 Апреля 2025

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    for ($i = 0; $i < 1; $i++) {
                $images[] = [
                    "noRetina" => [
                        "thumb" => BsHelper::imageUrl($productImages[0]["image"], 50, 50),
                    ],
                    "retina" => [
                        "thumb" => BsHelper::imageUrl($productImages[0]["image"], 100, 100),
                    ],
                ];
            }

    volodyahome, 26 Февраля 2025

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

    0

    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
    <!-- < ?php
    $isAdmin = User::checkAdmin();
    if($isAdmin) {
    ?>
    <section class="promoCertificate">
    <div class="promoCertificate__wrapper">
    <img class="promoCertificate__logo" src="/images/header/promoCertificate-logo-big.png">
    <div class="promoCertificate__title">
    <p class="promoCertificate__title_big">Это знак</p>
    <p class="promoCertificate__title_small">ЗН АК КАЧЕСТВА</p>
    </div>
    <img class="promoCertificate__nagiev" src="/images/header/promoCertificate-nagiev.png">
    <div class="promoCertificate__description">Ва м доступен <span class="promoCertificate__description_whi te">личный сертификат</span> на покупку массажного кресла номиналом <span class="promoCertificate__description_whi te promoCertificate__description_big ">30 000 ₽</span></div>
    <a href="/personal-certificate" class="promoCertificate__button-details">Подробнее</a>
    <button type="button" class="promoCertificate__button-close promoCertificate__button-close_mobile __js-closeCertificatePromo">не интересно</button>
    </div>
    <button type="button" class="promoCertificate__button-close __js-closeCertificatePromo"></button>
    </section>
    < ?php }; ?> -->
    <!-- модалка с количеством подарков и ссылкой на страницу подарков -->
    <!-- удалять prize__hide -->

    На сайте одного крупного производителя массажных кресел, прямо в исходном коде страницы отображается внебрачный ребенок Laravel и Bitrix -- чудесная смесь html и php прямо в одном файле и проверка прав пользователя прямо в исходном коде страницы.

    McLotos, 30 Января 2025

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

    0

    1. 1
    На сайте одного крупного производителя массажных кресел, прямо в исходном коде страницы отображается внебрачный ребенок Laravel и Bitrix -- чудесная смесь html и php прямо в одном файле и проверка прав пользователя прямо в исходном коде страницы.

    <!-- < ?php
    $isAdmin = User::checkAdmin();
    if($isAdmin) {
    ?>
    <section class="promoCertificate">
    <div class="promoCertificate__wrapper">
    <img class="promoCertificate__logo" src="/images/header/promoCertificate-logo-big.png">
    <div class="promoCertificate__title">
    <p class="promoCertificate__title_big">Это знак</p>
    <p class="promoCertificate__title_small">ЗН АК КАЧЕСТВА</p>
    </div>
    <img class="promoCertificate__nagiev" src="/images/header/promoCertificate-nagiev.png">
    <div class="promoCertificate__description">Ва м доступен <span class="promoCertificate__description_whi te">личный сертификат</span> на покупку массажного кресла номиналом <span class="promoCertificate__description_whi te promoCertificate__description_big ">30 000 ₽</span></div>
    <a href="/personal-certificate" class="promoCertificate__button-details">Подробнее</a>
    <button type="button" class="promoCertificate__button-close promoCertificate__button-close_mobile __js-closeCertificatePromo">не интересно</button>
    </div>
    <button type="button" class="promoCertificate__button-close __js-closeCertificatePromo"></button>
    </section>
    < ?php }; ?> -->
    <!-- модалка с количеством подарков и ссылкой на страницу подарков -->
    <!-- удалять prize__hide -->

    McLotos, 30 Января 2025

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

    0

    1. 1
    $_GET

    OCETuHCKuu_nemyx, 15 Октября 2024

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // Load the core Kohana class
    require SYSPATH . 'classes/Kohana/Core' . EXT;
    
    if (is_file(APPPATH . 'classes/Kohana' . EXT)) {
        // Application extends the core
        require APPPATH . 'classes/Kohana' . EXT;
    } else {
        // Load empty core extension
        require SYSPATH . 'classes/Kohana' . EXT;
    }

    нужно как можно больше констант

    1111nomi, 09 Сентября 2024

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

    −1

    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
    <?php echo "<?xml version='1.0' encoding='UTF-8'?>" ;
    $query = $_GET['q'];
    include 'cfg.php';
    $request = $lemnobase."search?part=id,snippet&maxResults=25&type=video&q=".urlencode($query);
    $ch = curl_init();
    curl_setopt(...);
    $ytdata = json_decode(curl_exec($ch), true);
    curl_close($ch);
      function getUsername($chid) {
          include 'cfg.php';
          $request = "https://www.googleapis.com/youtube/v3/channels?key=".$apikey."&part=snippet&id=".$chid;
          $ch = curl_init();
          curl_setopt(...);
          $responsee = json_decode(curl_exec($ch), true);
          curl_close($ch);
          return str_replace('@', '', $responsee["items"][0]["snippet"]["customUrl"]);
        }
    ?>
    <feed>
        <openSearch:totalResults><?php
     echo $ytdata['pageInfo']['totalResults'];
      ?></openSearch:totalResults>
        <openSearch:startIndex>1</openSearch:startIndex>
        <openSearch:itemsPerPage>25</openSearch:itemsPerPage>
    <?php
      for ($i=0;$i<25;$i++){
        
        include 'cfg.php';
        $request = $lemnobase."videos?part=contentDetails,statistics&id=".$ytdata["items"][$i]["id"]["videoId"];
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $request);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $response = json_decode(curl_exec($ch), true);
        curl_close($ch);
        $duration = new DateInterval ($response['items'][0]['contentDetails']['duration']);
        $duration_s = $duration->days * 86400 + $duration->h * 3600 + $duration->i * 60 + $duration->s;
        ?>
            <entry>
                <id><?php echo $shema ?>://<?php echo $insturl?>/feeds/api/videos/<?php echo $ytdata["items"][$i]["id"]["videoId"]?></id>
                <youTubeId id='<?php echo $ytdata["items"][$i]["id"]["videoId"]?>'><?php echo $ytdata["items"][$i]["id"]["videoId"]?></youTubeId>
                <published><?php echo $ytdata["items"][$i]["snippet"]["publishedAt"]?></published>
                <updated><?php echo $ytdata["items"][$i]["snippet"]["publishedAt"]?></updated>
                <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" label="People & Blogs" term="People & Blogs">People & Blogs</category>
                <title type='text'><?php echo $ytdata["items"][$i]["snippet"]["title"]?></title>
                <content type='text'><?php echo $ytdata["items"][$i]["snippet"]["description"]?></content>
                <link rel="http://gdata.youtube.com/schemas/2007#video.related" href="<?php echo $shema ?>://<?php echo $insturl?>/feeds/api/videos/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/related"/>
                <author>
                    <name><?php echo $ytdata["items"][$i]["snippet"]["channelTitle"] ?></name>
                    <uri>http://gdata.youtube.com/feeds/api/users/<?php echo getUsername($ytdata["items"][$i]["snippet"]["channelId"]) ?></uri>
                </author>
                <gd:comments>
                    <gd:feedLink href='<?php echo $shema ?>://<?php echo $insturl?>/feeds/api/videos/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/comments' countHint='530'/>
                </gd:comments>
                <media:group>
                    <media:category label='People & Blogs' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>People & Blogs</media:category>
                    <media:content url='https://yt2009akivec.onrender.com/channel_fh264_getvideo?v=<?php echo $ytdata["items"][$i]["id"]["videoId"]?>' type='video/3gpp' medium='video' expression='full' duration='999' yt:format='3'/>
                    <media:description type='plain'><?php echo $ytdata["items"][$i]["snippet"]["description"]?></media:description>
                    <media:keywords>-</media:keywords>
                    <media:player url='http://www.youtube.com/watch?v=<?php echo $ytdata["items"][$i]["id"]["videoId"]?>'/>
                    <media:thumbnail yt:name='hqdefault' url='http://i.ytimg.com/vi/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/hqdefault.jpg' height='240' width='320' time='00:00:00'/>
                    <media:thumbnail yt:name='poster' url='http://i.ytimg.com/vi/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/0.jpg' height='240' width='320' time='00:00:00'/>
                    <media:thumbnail yt:name='default' url='http://i.ytimg.com/vi/<?php echo $ytdata["items"][$i]["id"]["videoId"]?>/0.jpg' height='240' width='320' time='00:00:00'/>
                    <yt:duration seconds='<?php echo $duration_s?>'/>
                    <yt:videoid id='<?php echo $ytdata["items"][$i]["id"]["videoId"]?>'><?php echo $ytdata["items"][$i]["id"]["videoId"]?></yt:videoid>
                    <youTubeId id='<?php echo $ytdata["items"][$i]["id"]["videoId"]?>'><?php echo $ytdata["items"][$i]["id"]["videoId"]?></youTubeId>
                    <media:credit role='uploader' name='<?php echo $ytdata["items"][$i]["snippet"]["channelTitle"] ?>'><?php echo $ytdata["items"][$i]["snippet"]["channelTitle"] ?></media:credit>
                </media:group>
                <gd:rating average='5' max='5' min='1' numRaters='0' rel='http://schemas.google.com/g/2005#overall'/>
                <yt:statistics favoriteCount="0" viewCount="<?php echo $response['items'][0]['statistics']['viewCount'] ?>"/>
                <yt:rating numLikes="<?php echo $response['items'][0]['statistics']['likeCount'] ?>" numDislikes="0"/>
            </entry>
            
        <?php }; ?>
    </feed>

    Попытка спасти апи гугла для ютуба.
    Провалилась, ибо клиент ютуба оказался говном

    ququnta, 16 Июля 2024

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

    0

    1. 1
    2. 2
    3. 3
    <?php
    // ...
    parse_str($ShopParams, $shopParams);

    Регистр одной буквы всё меняет!

    jonnywalker, 16 Апреля 2024

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

    +1

    1. 1
    if ($text[2] == 'www.' or $text[2] == 'Www.' or $text[2] == 'wWw.' or $text[2] == 'wwW.' or $text[2] == 'WwW.' or $text[2] == 'WWw.' or $text[2] == 'wWW.' or $text[2] == 'WWW.')

    Можно было так: if(strtolower($text[2]) == 'www.')

    ququnta, 25 Марта 2024

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