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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public function validate($mailAddress)
    {
        $this->mailAddress = $mailAddress;
        if($this->validateMailAddress()) {
            if ($this->checkMXRecord()) {
                throw new \Exception('Mail is valid');
            }
        }
        throw new \Exception('Mail is invalid');
    }

    pefigah572, 04 Мая 2022

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

    +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
    $ss_n = 0;
    			$ss_nf = 0;
    			$ss_f = 0;
    			$ss_n_pl = 0;
    			$ss_nf_pl = 0;
    			$ss_f_pl = 0;
    			$ids_count = count($ids);
    		for ($i=0;$i < $ids_count;$i++) {
    			$key = $w_dates[$z]."|1|".$ids[$i];
    			$ss_n += $w_n_s[$key]*1;
    			$ss_nf += $w_nf_s[$key]*1;
    			$ss_f += $w_f_s[$key]*1;
    			$key = $w_dates[$z]."|2|".$ids[$i];
    			$ss_n += $w_n_s[$key]*1;
    			$ss_nf += $w_nf_s[$key]*1;
    			$ss_f += $w_f_s[$key]*1;
    			$key = $w_dates[$z]."|3|".$ids[$i];
    			$ss_n += $w_n_s[$key]*1;
    			$ss_nf += $w_nf_s[$key]*1;
    			$ss_f += $w_f_s[$key]*1;
    		}
    		$ids_count = count($ids);
    		for ($i=0;$i < $ids_count;$i++) {
    			$key = $w_dates[$z]."|1|".$ids[$i];
    			$ss_n_pl = $ss_n_pl + $w_n_s_pl[$key]*1;
    			$ss_nf_pl = $ss_nf_pl + $w_nf_s_pl[$key]*1;
    			$ss_f_pl = $ss_f_pl + $w_f_s_pl[$key]*1;
    			$key = $w_dates[$z]."|2|".$ids[$i];
    			$ss_n_pl = $ss_n_pl + $w_n_s_pl[$key]*1;
    			$ss_nf_pl = $ss_nf_pl + $w_nf_s_pl[$key]*1;
    			$ss_f_pl = $ss_f_pl + $w_f_s_pl[$key]*1;
    			$key = $w_dates[$z]."|3|".$ids[$i];
    			$ss_n_pl = $ss_n_pl + $w_n_s_pl[$key]*1;
    			$ss_nf_pl = $ss_nf_pl + $w_nf_s_pl[$key]*1;
    			$ss_f_pl = $ss_f_pl + $w_f_s_pl[$key]*1;
    		}
    
    		echo "<td class='Field' rowspan='3' style='vertical-align: middle;'><b>".OutNF($ss_n,$ss_nf,$ss_f)."</b></td>\n";
    		echo "<td class='Field' rowspan='3' style='vertical-align: middle;'><b style='color:#aa0000;'>".OutNF($ss_n_pl,$ss_nf_pl,$ss_f_pl)."</b></td>\n";
    
    		echo "</tr><tr>";
    
    		////////////////////////////////////////////////////////////
    		echo "<td class='Field' width='40' style='vertical-align: middle;'><b>II</b></td>\n";
    			$s_n = 0;
    			$s_nf = 0;
    			$s_f = 0;
    			$s_n_pl = 0;
    			$s_nf_pl = 0;
    			$s_f_pl = 0;
    		for ($i=0;$i < count($ids);$i++) {
    			$key = $w_dates[$z]."|2|".$ids[$i];
    			$s_n = $s_n + $w_n_s[$key]*1;
    			$s_nf = $s_nf + $w_nf_s[$key]*1;
    			$s_f = $s_f + $w_f_s[$key]*1;
    			$s_n_pl = $s_n_pl + $w_n_s_pl[$key]*1;
    			$s_nf_pl = $s_nf_pl + $w_nf_s_pl[$key]*1;
    			$s_f_pl = $s_f_pl + $w_f_s_pl[$key]*1;
    			if ($edti_stat[$key]==1){
    				echo "<td class='Field'>".OutNF($w_n_s[$key],$w_nf_s[$key],$w_f_s[$key])."</td>\n";
    			}
    			if ($edti_stat[$key]==0){
    				$link_dat = explode("|", $key);
    				$link_dat2 = $link_dat[0];
    				$link_dat3 = $link_dat[1];
    				echo "<td class='Field'><a target='_bland' href='index.php?do=show&formid=64&p0=".$link_dat2."&p1=".$link_dat3."'><b style='color:#aa0000;'>".OutNF($w_n_s_pl[$key],$w_nf_s_pl[$key],$w_f_s_pl[$key])."</b></a></td>\n";
    			}
    		}
    		echo "<td class='Field'></td>\n";
    		echo "<td class='Field'><b>".OutNF($s_n,$s_nf,$s_f)."</b></td>\n";
    		echo "<td class='Field'></td>\n";
    		echo "<td class='Field'></td>\n";
    		echo "<td class='Field'><b style='color:#aa0000;'>".OutNF($s_n_pl,$s_nf_pl,$s_f_pl)."</b></td>\n";
    		echo "<td class='Field'></td>\n";
    		////////////////////////////////////////////////////////////

    kib0rg, 22 Апреля 2022

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

    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
    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
    if ($arr_tbl_1[$key_1] !== $cur_vid){
    		$cur_vid_key = $key_1;
    		$cur_vid_w = $arr_tbl_1[$key_1];
    		$cur_v_ind = $cur_v_ind + 1;
    		while ($arr_tbl_1[$cur_vid_key] == $cur_vid_w){
    			$sum_cur_v_6 += (float)$arr_tbl_6[$cur_vid_key];
    			$sum_cur_v_7 += (float)$arr_tbl_7[$cur_vid_key];
    			$sum_cur_v_10 += (float)$arr_tbl_10[$cur_vid_key];
    			$cur_vid_key += 1;
    		}
    		if ($sum_cur_v_6==0) { $sum_cur_v_6_0 = 1;}else{ $sum_cur_v_6_0 = $sum_cur_v_6;}
    		if ($sum_cur_v_7==0) { $sum_cur_v_7_0 = 1;}else{ $sum_cur_v_7_0 = $sum_cur_v_7;}
    		if (strlen(substr(strstr($sum_cur_v_6, "."), 1))==0) { $tbl_1_6 = $sum_cur_v_6.".00";}
    		if (strlen(substr(strstr($sum_cur_v_6, "."), 1))==1) { $tbl_1_6 = $sum_cur_v_6."0";}
    		if (strlen(substr(strstr($sum_cur_v_6, "."), 1))==2) { $tbl_1_6 = $sum_cur_v_6;}
    		if (strlen(substr(strstr($sum_cur_v_6, "."), 1))>2) { $tbl_1_6 = number_format($sum_cur_v_6, 2, '.', '');}
    		if (strlen(substr(strstr($sum_cur_v_7, "."), 1))==0) { $tbl_1_7 = $sum_cur_v_7.".00";}
    		if (strlen(substr(strstr($sum_cur_v_7, "."), 1))==1) { $tbl_1_7 = $sum_cur_v_7."0";}
    		if (strlen(substr(strstr($sum_cur_v_7, "."), 1))==2) { $tbl_1_7 = $sum_cur_v_7;}
    		if (strlen(substr(strstr($sum_cur_v_7, "."), 1))>2) { $tbl_1_7 = number_format($sum_cur_v_7, 2, '.', '');}
    		if (strlen(substr(strstr(($sum_cur_v_6-$sum_cur_v_7), "."), 1))==0) { $tbl_1_8 = ($sum_cur_v_6-$sum_cur_v_7).".00";}
    		if (strlen(substr(strstr(($sum_cur_v_6-$sum_cur_v_7), "."), 1))==1) { $tbl_1_8 = ($sum_cur_v_6-$sum_cur_v_7)."0";}
    		if (strlen(substr(strstr(($sum_cur_v_6-$sum_cur_v_7), "."), 1))==2) { $tbl_1_8 = ($sum_cur_v_6-$sum_cur_v_7);}
    		if (strlen(substr(strstr(($sum_cur_v_6-$sum_cur_v_7), "."), 1))>2) { $tbl_1_8 = number_format(($sum_cur_v_6-$sum_cur_v_7), 2, '.', '');}
    		if (strlen(substr(strstr(($sum_cur_v_7/$sum_cur_v_6_0*100), "."), 1))==0) { $tbl_1_9 = ($sum_cur_v_7/$sum_cur_v_6_0*100).".00";}
    		if (strlen(substr(strstr(($sum_cur_v_7/$sum_cur_v_6_0*100), "."), 1))==1) { $tbl_1_9 = ($sum_cur_v_7/$sum_cur_v_6_0*100)."0";}
    		if (strlen(substr(strstr(($sum_cur_v_7/$sum_cur_v_6_0*100), "."), 1))==2) { $tbl_1_9 = ($sum_cur_v_7/$sum_cur_v_6_0*100);}
    		if (strlen(substr(strstr(($sum_cur_v_7/$sum_cur_v_6_0*100), "."), 1))>2) { $tbl_1_9 = number_format(($sum_cur_v_7/$sum_cur_v_6_0*100), 2, '.', '');}
    		if (strlen(substr(strstr($sum_cur_v_10, "."), 1))==0) { $tbl_1_10 = $sum_cur_v_10.".00";}
    		if (strlen(substr(strstr($sum_cur_v_10, "."), 1))==1) { $tbl_1_10 = $sum_cur_v_10."0";}
    		if (strlen(substr(strstr($sum_cur_v_10, "."), 1))==2) { $tbl_1_10 = $sum_cur_v_10;}
    		if (strlen(substr(strstr($sum_cur_v_10, "."), 1))>2) { $tbl_1_10 = number_format($sum_cur_v_10, 2, '.', '');}
    		if (strlen(substr(strstr(($sum_cur_v_10/$sum_cur_v_7_0), "."), 1))==0) { $tbl_1_11 = ($sum_cur_v_10/$sum_cur_v_7_0).".00";}
    		if (strlen(substr(strstr(($sum_cur_v_10/$sum_cur_v_7_0), "."), 1))==1) { $tbl_1_11 = ($sum_cur_v_10/$sum_cur_v_7_0)."0";}
    		if (strlen(substr(strstr(($sum_cur_v_10/$sum_cur_v_7_0), "."), 1))==2) { $tbl_1_11 = ($sum_cur_v_10/$sum_cur_v_7_0);}
    		if (strlen(substr(strstr(($sum_cur_v_10/$sum_cur_v_7_0), "."), 1))>2) { $tbl_1_11 = number_format(($sum_cur_v_10/$sum_cur_v_7_0), 2, '.', '');}
    		echo "<tr>
    		<td class='field' style='background:#CBDEF4;' colspan='5'><b class='not_tr' name='arr_tbl_1_".$cur_v_ind."' style='cursor:pointer; border:1px solid #000; border-radius:6px;' onclick='show_tr_1(this.getAttribute(\"name\"), this.getAttribute(\"class\"), this);'> + </b><b class='not_tr' name='arr_tbl_1_".$cur_v_ind."' style='display:none; cursor:pointer; border:1px solid #000; border-radius:6px;' onclick='show_tr_2(this.getAttribute(\"name\"), this.getAttribute(\"class\"), this);'> -  </b> ".$arr_tbl_1[$key_1]."</td>
    		<td name='max_numb_6' class='field' style='text-align:right; background:#CBDEF4;'>".$tbl_1_6."</td>
    		<td name='max_numb_7' class='field' style='text-align:right; background:#CBDEF4;'>".$tbl_1_7."</td>
    		<td name='max_numb_8' class='field' style='text-align:right; background:#CBDEF4;'>".$tbl_1_8."</td>
    		<td name='max_numb_9' class='field' style='text-align:right; background:#CBDEF4;'>".$tbl_1_9."</td>
    		<td name='max_numb_10' class='field' style='text-align:right; background:#CBDEF4;'>".$tbl_1_10."</td>
    		<td name='max_numb_11' class='field' style='text-align:right; background:#CBDEF4;'>".$tbl_1_11."</td>
    		</tr>";
    		$itog_sum_6 += $sum_cur_v_6;
    		$itog_sum_7 += $sum_cur_v_7;
    		$itog_sum_10 += $sum_cur_v_10;
    		
    		$tbl_1_6 = "";
    		$tbl_1_7 = "";
    		$tbl_1_8 = "";
    		$tbl_1_9 = "";
    		$tbl_1_10 = "";
    		$tbl_1_11 = "";
    		$sum_cur_v_6 = 0;
    		$sum_cur_v_7 = 0;
    		$sum_cur_v_10 = 0;
    	}

    kib0rg, 22 Апреля 2022

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

    0

    1. 1
    2. 2
    3. 3
    $path = str_replace("\\", "/", __FILE__);
    $path = substr($path, 0, strlen($path) - strlen("/index.php"));
    include($path."/version.php");

    официальный гайд битрикса по установке модулей))
    https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=101&LESSON_ID=2902
    мне литерали плохо уже

    x3x3n0m0rph, 19 Апреля 2022

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

    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
    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
    // Проверка активных ip-адресов
    $is_active = false;
    if ($dir = opendir($path_active)) {
        while (false !== ($filename = readdir($dir))) {
            // Выбирается ip + время активации этого ip
            if (preg_match('#^(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})_(\d+)$#', $filename, $matches)) {
                if ($matches[2] >= time() - self::intervalSeconds) {
                    if ($matches[1] == $ip_address) {
                        $times = intval(trim(file_get_contents($path_active . $filename)));
                        if ($times >= self::intervalTimes - 1) {
                            touch($path_block . $filename);
                            unlink($path_active . $filename);
                        } else {
                            file_put_contents($path_active . $filename, $times + 1);
                        }
                        $is_active = true;
                    }
                } else {
                    unlink($path_active . $filename);
                }
            }
        }
        closedir($dir);
    }
    
    // Проверка заблокированных ip-адресов
    $is_block = false;
    if ($dir = opendir($path_block)) {
        while (false !== ($filename = readdir($dir))) {
            // Выбирается ip + время блокировки этого ip
            if (preg_match('#^(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})_(\d+)$#', $filename, $matches)) {
                if ($matches[2] >= time() - self::blockSeconds) {
                    if ($matches[1] == $ip_address) {
                        $is_block = true;
                        $time_block = $matches[2] - (time() - self::blockSeconds) + 1;
                    }
                } else {
                    unlink($path_block . $filename);
                }
            }
        }
        closedir($dir);
    }
    
    // ip-адрес заблокирован
    if ($is_block) {
        header('HTTP/1.0 502 Bad Gateway');
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
        echo '<html xmlns="http://www.w3.org/1999/xhtml">';
        echo '<head>';
        echo '<title>502 Bad Gateway</title>';
        echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
        echo '</head>';
        echo '<body>';
        echo '<h1 style="text-align:center">502 Bad Gateway</h1>';
        echo '<p style="background:#ccc;border:solid 1px #aaa;margin:30px au-to;padding:20px;text-align:center;width:700px">';
        echo 'К сожалению, Вы временно заблокированы, из-за частого запроса страниц сайта.<br />';
        echo 'Вам придется подождать. Через ' . $time_block . ' секунд(ы) Вы будете автоматически разблокированы.';
        echo '</p>';
        echo '</body>';
        echo '</html>';
        exit;
    }

    PHP-скрипт для защиты от DDOS, парсинга и ботов
    https://habr.com/ru/post/659811/

    ISO, 08 Апреля 2022

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

    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
    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
    <?php
    public function submit()
    {
    	$requestUri = 'http://127.0.0.1:8000/test/hs/Services/GetShedule';
    	$response = $this->doPostCall($requestUri . '?' . $this->prepareParams(), null);
    	$temp_str = json_encode(mb_convert_encoding($response, 'UTF-8'));
    	$temp_str = str_replace('\ufeff', '', $temp_str);
    	$temp_str = str_replace('\r', '', $temp_str);
    	$temp_str = str_replace('\n', '', $temp_str);
    	$temp_str = str_replace('\"', '"', $temp_str);
    	$temp_str = mb_strcut($temp_str, 1, -1);
    	$temp_arr = json_decode($temp_str, true);
    
    	$post_main_data = [];
    	$post_sub_data = [];
    	
    	foreach($temp_arr as $main_unit_key => $main_unit_value) {
    		foreach($main_unit_value as $main_unit_feature_key => $main_unit_feature_value) {
    			foreach ($main_unit_feature_value as $sub_unit_key => $sub_unit_value) {
    				foreach($sub_unit_value as $sub_unit_feature_key => $sub_unit_feature_value) {
    					unset($sub_unit_value['Расписание']);
    					$post_sub_data[$main_unit_key][$main_unit_feature_key][$sub_unit_key] = $sub_unit_value;
    				}
    			}
    		}
    	}
    
    	$raw_data = $temp_arr;
    	$filter = array('Посты');
    	$raw_data_length = count($raw_data);
    	for ($row = 0; $row < $raw_data_length; $row++) {
    		$post_main_data[] = array_diff_key($raw_data[$row], array_flip($filter));
    	}
    
    	foreach($post_main_data as $pmd_key => $pmd_value) {
    		$post_main_data[$pmd_key][key($post_sub_data[$pmd_key])] = array_values(array_values($post_sub_data[$pmd_key])[0]);
    	}
    
    	header_remove();
    	header("Content-Type: application/json");
    	http_response_code(200);
    	exit();
    }
    ?>

    JohnDoe, 04 Апреля 2022

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

    +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
    <?php defined('SYSPATH') or die('No direct script access.');
    /*
     * Базовый класс главной страницы
     */
    class Controller_Index extends Controller {
    
    
            public function before() {
                    parent::before();
                    I18n::lang('ru');
                    $settings = Kohana::config('settings');
                    Cookie::$salt = 'asd12d2';
                    Session::$default = 'cookie';
                    $this->session = Session::instance();
            }
    
        public function action_index() {
    
            //Путь до файла первоночального xml (xsl)
            $path_xml='tpl/xml.xsl';
            //Путь конечного xsl
            $path_xsl='tpl/index.xsl';
    
            $url = $this->request->param('stuff');
                    //print_r($_SERVER);
                    /*if($_SERVER ['REQUEST_URI']=='/'){
                            $this->request->redirect($_SERVER ['HTTP_X_FORWARDED_PROTO'].'://'.$_SERVER['HTTP_HOST'],'301');
                    }*/
            if(empty($url)){
                $url='/';
            }
    
    
            $htmlfile='cache-html/'.md5($url);
    $allurl=$_SERVER ['REQUEST_URI'];
    if($allurl=='/20-40-kvm') $this->request->redirect('/sadovye-domiki','301');
    if($allurl=='/40-80-kvm') $this->request->redirect('/sadovye-domiki','301');
    if($allurl=='/80-i-bolee-kvm') $this->request->redirect('/sadovye-domiki','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=0&destination%5B%5D=1&destination%5B%5D=2&technology%5B%5D=0&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=0-3000000&area=0-400') $this->request->redirect('/sadovye-domiki','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=1&technology%5B%5D=0&technology%5B%5D=1&technology%5B%5D=2&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=0-3000000&area=81-400') $this->request->redirect('/80-i-bolee-kvm','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=1&technology%5B%5D=0&technology%5B%5D=1&technology%5B%5D=2&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=0-3000000&area=40-80') $this->request->redirect('/40-80-kvm','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=0&technology%5B%5D=0&technology%5B%5D=1&technology%5B%5D=2&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=0-3000000&area=0-400') $this->request->redirect('/stroitelstvo-dachnyh-domov','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=2&technology%5B%5D=0&technology%5B%5D=1&technology%5B%5D=2&technology%5B%5D=3&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=0-3000000&area=0-400') $this->request->redirect('/kottedzhi','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=3&technology%5B%5D=0&technology%5B%5D=2&technology%5B%5D=3&floors%5B%5D=1&floors%5B%5D=1.5&price=0-3000000&area=0-400') $this->request->redirect('/bani','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=3&technology%5B%5D=2&floors%5B%5D=1&floors%5B%5D=1.5&price=0-3000000&area=0-400') $this->request->redirect('/bani-iz-profilirovannogo-brusa','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=3&technology%5B%5D=0&floors%5B%5D=1&floors%5B%5D=1.5&price=0-3000000&area=0-400') $this->request->redirect('/karkasnye-bani','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=3&technology%5B%5D=3&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=0-3000000&area=0-400') $this->request->redirect('/bani-iz-ocilindrovannogo-brevna','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=0&destination%5B%5D=1&destination%5B%5D=2&technology%5B%5D=2&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=316018-3000000&area=0-400') $this->request->redirect('/brus','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=0&destination%5B%5D=1&destination%5B%5D=2&technology%5B%5D=2&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=0-3000000&area=0-400') $this->request->redirect('/kottedzhi-profilirovannyj-brus','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=0&destination%5B%5D=1&destination%5B%5D=2&technology%5B%5D=0&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=329056-3000000&area=0-400') $this->request->redirect('/dachnye-doma-karkasnaya-tehnologiya','301');
    
    if($allurl=='/nashi-proecty?searcher=48291&section=3924&destination%5B%5D=0&destination%5B%5D=1&destination%5B%5D=2&technology%5B%5D=1&floors%5B%5D=1&floors%5B%5D=1.5&floors%5B%5D=2&price=0-3000000&area=0-400') $this->request->redirect('/individualnye-proekty','301');

    Там ещё дальше веселье продолжается, но гк не дает запостить больше

    YpaHeLI_, 02 Апреля 2022

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

    +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
    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
    $mysql = new mysqli($host, $db_user, $db_pass, $db_name);
    mysqli_set_charset($mysql, "utf8");
    
    
    $region = mysqli_query($mysql, "SELECT *  FROM `rubric_subsection`");
    while ($rows_rubriki = mysqli_fetch_array($region)) 
    {
    	
    //	$razdel = mysqli_query($mysql, "SELECT *  FROM `city_region` LIMIT 1");
    	//while ($raz = mysqli_fetch_array($razdel)) {
    	
    $rubriki = mysqli_query($mysql, "SELECT `region`, `subsection`, COUNT(region) as count FROM `big_baza` where `region` =  'Республика Бурятия' AND `subsection` = '".$rows_rubriki['name']."'");
    $data = mysqli_fetch_assoc($rubriki);
    echo ''.$rows_rubriki['name'].' / '.$data['count'].'<br>';
    //mysqli_query($mysql,  "INSERT INTO `calculator_region`(`id`, `region_id`, `subsection_id`, `count`) VALUES ('','".$raz['id']."','".$rows_rubriki['id']."','".$data['count']."')");
    
    //	}
    
    }

    dlyaspama7771, 16 Марта 2022

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

    0

    1. 1
    https://gitflic.ru/

    https://gitflic.ru/

    Ебаная паРаша.

    MouseZver, 09 Марта 2022

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

    +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
    case 'sav8':
    if (isset($user) & $user['balls'] < $color[cena2])
    {
    echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
    }else{
    mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
    mysql_query("UPDATE `user` SET `ncolor`='#FFA500'  WHERE `id` = '$user[id]'");
    mysql_query("UPDATE `user` SET `ncolor2`='#FFA500'  WHERE `id` = '$user[id]'");
    echo 'Сохранено!<br/>'; } break;
    
    case 'sav9':
    if (isset($user) & $user['balls'] < $color[cena2])
    {
    echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
    }else{
    mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
    mysql_query("UPDATE `user` SET `ncolor`='#8B008B'  WHERE `id` = '$user[id]'");
    mysql_query("UPDATE `user` SET `ncolor2`='#8B008B'  WHERE `id` = '$user[id]'");
    echo 'Сохранено!<br/>'; } break;
    
    case 'sav10':
    if (isset($user) & $user['balls'] < $color[cena2])
    {
    echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
    }else{
    mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
    mysql_query("UPDATE `user` SET `ncolor`='#000000'  WHERE `id` = '$user[id]'");
    mysql_query("UPDATE `user` SET `ncolor2`='#000000'  WHERE `id` = '$user[id]'");
    echo 'Сохранено!<br/>'; } break;
    
    case 'sav11':
    if (isset($user) & $user['balls'] < $color[cena2])
    {
    echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
    }else{
    mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
    mysql_query("UPDATE `user` SET `ncolor`='#696969'  WHERE `id` = '$user[id]'");
    mysql_query("UPDATE `user` SET `ncolor2`='#696969'  WHERE `id` = '$user[id]'");
    echo 'Сохранено!<br/>'; } break;
    
    case 'sav12':
    if (isset($user) & $user['balls'] < $color[cena2])
    {
    echo "Недостаточно баллов.Надо :$color[cena2] баллов.А у вас <b>$user[balls]</b>\n";
    }else{
    mysql_query("UPDATE `user` SET `balls` = '".($user['balls']-$color['cena2'])."' WHERE `id` = '$user[id]' LIMIT 1",$db);
    mysql_query("UPDATE `user` SET `ncolor`='#FFFFFF'  WHERE `id` = '$user[id]'");
    mysql_query("UPDATE `user` SET `ncolor2`='#FFFFFF'  WHERE `id` = '$user[id]'");
    echo 'Сохранено!<br/>'; } break;

    Код смены цвета ника для одной популярной CMS доставшийся в "наследство" от клиента. Кто и под чем писал - без понятия.

    lionovsky, 18 Февраля 2022

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