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

    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
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    $dump = preg_replace_callback(
        '/
            (?<utf8>
                [\x09\x0A\x0D\x20-\x7E]
                | [\xC2-\xDF][\x80-\xBF]
                | \xE0[\xA0-\xBF][\x80-\xBF]
                | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}
                | \xED[\x80-\x9F][\x80-\xBF]  
                | \xF0[\x90-\xBF][\x80-\xBF]{2}
                | [\xF1-\xF3][\x80-\xBF]{3} 
                | \xF4[\x80-\x8F][\x80-\xBF]{2}
            )
            |
            (?<trash>.)
        /xs',
        function (array $match) {
            if (isset($match['utf8']) && strlen($match['utf8']) > 0) {
                $char = $match['utf8'];
                if (strlen($char) === 1 && ord($char) < 31) {
                    return '\x' . bin2hex($char);
                } else {
                    return $char;
                }
            } else {
                return '\x' . bin2hex($match['trash']);
            }
        },
        hex2bin('2cd2d948cfaf4b1097530f7c74fb6737')
    );
    
    var_dump($dump);

    https://phpclub.ru/talk/threads/bytes-fromhex-в-php.86568/
    Матёрые пхпшники переводят «Python» на «PHP».

    gost, 22 Марта 2020

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

    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
    <div class="choose_payment">
                    	<div class="title"><span>2</span>Выберите способы оплаты (все без комиссии)</div>
                        <!-- all terminals -->
                        <div class="all_terminals">
                              <!-- fike: конечно же тут были все терминалы, а вы как думали? -->
                        </div>        
    					<!-- payments. no commisson -->
                       <div class="no_commission"><label>
                        	<div class="title_no_commission"><i>Подсказка:</i></div>
                            
                            <div class="we_recommend_2">
                            	<div class="title_we_recommend_2">
    					Оплачиваете первый раз?<br>
    					наши специалисты ответят на все вопросы <br>
    					<!--?phpphp echo preg_replace("/([0-9]{1})([0-9]{3})([0-9]{3})([0-9]{2})([0-9]{2})/", "+$1 ($2) $3-$4-$5", SUPPORT_PHONE); ?--> ежедневно с 10:00 до 19:00
    				</div>
                            </div>
    						</label>
                        </div>
                    </div>

    А впрочем нет, не ответят

    Fike, 20 Марта 2020

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

    +3

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    <?php
    
    define('BOT_TOKEN', '12345678:replace-me-with-real-token');
    define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
    
    function apiRequestWebhook($method, $parameters) {
      if (!is_string($method)) {
        error_log("Method name must be a string\n");
        return false;
      }
    
      if (!$parameters) {
        $parameters = array();
      } else if (!is_array($parameters)) {
        error_log("Parameters must be an array\n");
        return false;
      }
    
      $parameters["method"] = $method;
    
      header("Content-Type: application/json");
      echo json_encode($parameters);
      return true;
    }
    
    function exec_curl_request($handle) {
      $response = curl_exec($handle);
    
      if ($response === false) {
        $errno = curl_errno($handle);
        $error = curl_error($handle);
        error_log("Curl returned error $errno: $error\n");
        curl_close($handle);
        return false;
      }
    
      $http_code = intval(curl_getinfo($handle, CURLINFO_HTTP_CODE));
      curl_close($handle);
    
      if ($http_code >= 500) {
        // do not wat to DDOS server if something goes wrong
        sleep(10);
        return false;
      } else if ($http_code != 200) {
        $response = json_decode($response, true);
        error_log("Request has failed with error {$response['error_code']}: {$response['description']}\n");
        if ($http_code == 401) {
          throw new Exception('Invalid access token provided');
        }
        return false;
      } else {
        $response = json_decode($response, true);
        if (isset($response['description'])) {
          error_log("Request was successful: {$response['description']}\n");
        }
        $response = $response['result'];
      }
    
      return $response;
    }
    
    function apiRequest($method, $parameters) {
      if (!is_string($method)) {
        error_log("Method name must be a string\n");
        return false;
      }
    
      if (!$parameters) {
        $parameters = array();
      } else if (!is_array($parameters)) {
        error_log("Parameters must be an array\n");
        return false;
      }
    
      foreach ($parameters as $key => &$val) {
        // encoding to JSON array parameters, for example reply_markup
        if (!is_numeric($val) && !is_string($val)) {
          $val = json_encode($val);
        }
      }
      $url = API_URL.$method.'?'.http_build_query($parameters);
    
      $handle = curl_init($url);
      curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
      curl_setopt($handle, CURLOPT_TIMEOUT, 60);
    
      return exec_curl_request($handle);
    }
    
    function apiRequestJson($method, $parameters) {
      if (!is_string($method)) {
        error_log("Method name must be a string\n");
        return false;
      }
    
      if (!$parameters) {
        $parameters = array();
      } else if (!is_array($parameters)) {
        error_log("Parameters must be an array\n");

    r4wall, 17 Марта 2020

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

    +2

    1. 1
    Оффтоп словаря терминов говнокода.

    Для всего, что хотели ответить на комментарий из http://govnokod.ru/26478.
    Поддержим чистоту расы словаря!

    1024--, 11 Марта 2020

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

    −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
    <form>
    <link rel="stylesheet" href="css4.css">
    <div class="four"><h1 align="center"><b>Выберите что будете накручивать:</b></h1></div><br>
    <center><input class="fti" type="radio" name="message" value="Подписчики" id="marg2" required><b>Подписчики(1000шт. - 200₽)</b><br></center>
    <center><input class="fti" type="radio" name="message" value="Лайки" id="marg2" required><b>Лайки(1000шт. - 200₽)</b><br></center>
    <center>Укажите количество:</center>
    <center><input type="number" name="count" class="iinput" value="1" id="a" name="count" min="10" max="10000" required oninput="b.value=(this.value*.2).toFixed(2)"> шт.<br></center>
    <center>Укажите ссылку:</center>
    <center><input type="url" name="url" class="iinput" placeholder="www.instagram.com/example/" id="marg" required><br></center>
    <center>Укажите ваш Email:</center>
    <center><input type="email" name="email" class="iinput" placeholder="[email protected]" id="marg" required><br></center>
    <center>Будет списано:</center>
    <center><input type="number" id="b" name="out" class="iinput" readonly="readonly">₽</center>
    <a href="glavn.html" id="al">На главную</a>
    
    <center><input type="submit" href="glavn.html" id="af" value="Отправить"></div></center><br>
    <center><i class="fa fa-info-circle" aria-hidden="true" style="color:#D3D3D3;"><b style="color:#D3D3D3;">ЗАКАЗ ПРИДЁТ В ТЕЧЕНИИ 24 ЧАСОВ</b></i></center>
    
    </form>
    <?

    Давайте течь от «PHPClub».

    https://phpclub.ru/talk/threads/Помогите-с-отправкой-формы-на-email.86557/
    >>> Я не могу отправлять данные с форм на сайте на свою почту.Я пробовал много способов но у меня не получалось.Буду благодарен за помощь в создании кода php.
    >>> Выберите что будете накручивать

    gost, 10 Марта 2020

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

    +1

    1. 1
    2. 2
    3. 3
    /index.php/module/action/param1/${@die(md5(HelloThinkPHP))}: 1 Time(s)
           /index.php?s=%2f%69%6e%64%65%78%2f%5c%74%6 ... %6e%6b%50%48%50: 1 Time(s)
           /index.php?s=/module/action/param1/${@die( ... elloThinkPHP))}: 1 Time(s)

    такую вот хуйню в логах вижу
    пыха у меня разумеется никакого нет, но что это вообще такое? Что так ломают?

    MAKAKA, 09 Марта 2020

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

    +3

    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
    <?php
    var lastmsgid=$('.chat-msg:eq(0)',$(this).parent()).data('messageid');
    var lastmsg=$('#chat .chat-msg[data-messageid='+lastmsgid+']');
    var lastmsgscroll=lastmsg.offset().top;
    var lastscroll=$('#chat .messages').scrollTop();
    $(this).attr('disabled','disabled');var button=$(this);$.ajax({
    
              url: '<?=$baseHref;?>chat.php?more=1&user=<?=(int)$_GET['user'];?>&last=<?=(int)$last;?>',
    
              success: function(data) {
            if(data!='err'){
    data=JSON.parse(data);
    button.parent().prepend(data.messages);button.remove();fixdates();
    /*smiles*/$('#chat .messages .chat-msg div:not(.smilesadded)').each(function(){$(this).addClass('smilesadded').html(replacesmiles($(this).html()));});
    if($('#chat .messages').scrollTop()==0)$('#chat .messages').scrollTop(lastscroll-lastmsgscroll+lastmsg.offset().top);//prepend и так это делает. но не всегда
    
    } else {alert('Error');button.removeAttr('disabled');}
              },
              error:  function(xhr, str){
    	    alert('Error: ' + xhr.responseCode);
                   button.removeAttr('disabled');
              }
            });" class="btn-more button" style="margin-top:20px;margin-bottom:20px;"><?_e('Загрузить ещё');?></button><?}
    if(!isset($_GET['checknew']))$messages=array_reverse($messages);
    $user=mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT * FROM users WHERE `id`=".(int)$_GET['user']." LIMIT 1;"));
    foreach($messages as $data){
    if($yourdirection==$data['direction'])$userid=$account['id']; else $userid=(int)$_GET['user'];
    
    
    $fake=0;
    if(substr($data['text'],0,7)==':attach' && substr($data['text'],-1)==':'){$data['attachment']='../no-attach-premium.png?';if($premium)$data['attachment']=substr($data['text'],7,-1);$data['text']='';$fake=1;}
    ?>

    И сказал Господь: сойдем же и смешаем языки их, чтобы один не понимал речи другого.

    soxati, 05 Марта 2020

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

    +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
    <?php
    
      class Pet {
      
        protected $name;
    
        public function __construct($name) {
          echo "Setting name to " . $name . "\n";
          $this->name = $name;
        } 
    
        public function eat() {
          echo $this->name . " is eating.\n";
        }
      }
    
      $var = 30;
      $a_pet = new Pet("Spike"); 
      $a_pet->eat();
    ?>
    
    ---
    
    <?php
    
    function Pet__construct(&$objInst, $name)
    {
        echo 'Setting name to ' . $name . '
    ';
        $objInst['name'] = $name;
    }
    function Pet_eat(&$objInst)
    {
        echo $objInst['name'] . ' is eating.
    ';
    }
    $Pet = array('__vars' => array('name' => null));
    $var = 30;
    $a_pet = array_merge($Pet['__vars'], array('__type' => 'Pet'));
    Pet__construct($a_pet, 'Spike');
    Pet_eat($a_pet);

    Конвертер из ООП в процедурный стиль.
    Make PHP great again.

    https://github.com/PatrickZurekUIC/PHP-OOP-Converter

    Fike, 05 Марта 2020

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

    0

    1. 1
    Именно поэтому я за "РНР".

    gostinho, 03 Марта 2020

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $dbSort = Array("SORT" => "ASC");
    $dbFilter = Array("IBLOCK_ID" => $arResult["IBLOCK_ID"], "ID" => $arResult["ID"]);
    $dbSelect = Array("UF_MODEL_HEADLINE", "UF_CALC_HEADLINE", "UF_H1", "UF_ADVANTAGE_TITLE");
    $db_list = CIBlockSection::GetList($dbSort, $dbFilter, false, $dbSelect);
    $result = $db_list->GetNext();
    $arResult["MODEL_HEADLINE"] = $result["UF_MODEL_HEADLINE"];
    $arResult["CALC_HEADLINE"] = $result["UF_CALC_HEADLINE"];
    $arResult["UF_H1"] = $result["UF_H1"];
    $arResult["UF_ADVANTAGE_TITLE"] = $result["UF_ADVANTAGE_TITLE"];

    phpBidlokoder2, 21 Февраля 2020

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