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

    +176

    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
    $navChain=array();
       for($i = 0; $i < count($menu); $i++){
    		if (is_array($menu[$i]['subMenu'])) {
    			for($j = 0; $j < count($menu[$i]['subMenu']); $j++){
    				if (is_array($menu[$i]['subMenu'][$j]['subMenu'])) {
    					for($k = 0; $k < count($menu[$i]['subMenu'][$j]['subMenu']); $k++){
    						if (is_array($menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu'])) {
    							for($l = 0; $l < count($menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu']); $l++){
    								if (is_array($menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu'][$l]['subMenu'])) {
    									for($m = 0; $m < count($menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu'][$l]['subMenu']);$m++){
    										if ($menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu'][$l]['subMenu'][$m]['selected']=='1') {
    											$navChain[]=$menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu'][$l]['subMenu'][$m];
    											$menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu'][$l]['selected']=1;
    											$navChain[]=$menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu'][$l];
    											$menu[$i]['subMenu'][$j]['subMenu'][$k]['selected']=1;
    											$navChain[]=$menu[$i]['subMenu'][$j]['subMenu'][$k];
    											$menu[$i]['subMenu'][$j]['selected']=1;
    											$navChain[]=$menu[$i]['subMenu'][$j];
    											$menu[$i]['selected']=1;
    											$navChain[]=$menu[$i];
    										}
    									} // for
    								}
    								if ($menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu'][$l]['selected']=='1') {
    									$navChain[]=$menu[$i]['subMenu'][$j]['subMenu'][$k]['subMenu'][$l];
    									$menu[$i]['subMenu'][$j]['subMenu'][$k]['selected']=1;
    									$navChain[]=$menu[$i]['subMenu'][$j]['subMenu'][$k];
    									$menu[$i]['subMenu'][$j]['selected']=1;
    									$navChain[]=$menu[$i]['subMenu'][$j];
    									$menu[$i]['selected']=1;
    									$navChain[]=$menu[$i];
    								}
    							} // for
    						}
    						if ($menu[$i]['subMenu'][$j]['subMenu'][$k]['selected']=='1') {
    						$navChain[]=$menu[$i]['subMenu'][$j]['subMenu'][$k];
    							$menu[$i]['subMenu'][$j]['selected']=1;
    							$navChain[]=$menu[$i]['subMenu'][$j];
    							$menu[$i]['selected']=1;
    							$navChain[]=$menu[$i];
    						}
    					} // for
    				}
    				if ($menu[$i]['subMenu'][$j]['selected']=='1') {
    					$navChain[]=$menu[$i]['subMenu'][$j];
    					$menu[$i]['selected']=1;
    					$navChain[]=$menu[$i];
    				}
    			} // for
    		}
    		if ($menu[$i][selected] && empty($navChain)) {
    			$navChain[]=$menu[$i];
    		}
    	} // for

    volatile, 09 Апреля 2011

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

    +146

    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
    <?php 
    
    /** 
     * @class Sanitize 
     * @author Nirmit Bothra 
     * @copyright 2007 
     * @description This class sanitizes all user input which are accessed by PHP using POST, GET or REQUEST variables. Data sanitation helps in making  
     *                safe transactions with a database.  
     */ 
    
    class sanitize { 
        function sanitize() { 
            // class constructor and  
            $this->sanitizeCookie(); 
            $this->sanitizeGet(); 
            $this->sanitizeRequest(); 
            $this->sanitizePost(); 
        } 
         
        function sanitizePost() { 
            foreach($_POST as $key=>$value) { 
                $_POST[$key] = addslashes($value); 
            } 
        } 
        function sanitizeGet() { 
            foreach($_GET as $key=>$value) { 
                $_GET[$key] = addslashes($value); 
            } 
        } 
        function sanitizeRequest() { 
            foreach($_REQUEST as $key=>$value) { 
                $_REQUEST[$key] = addslashes($value); 
            } 
        } 
        function sanitizeCookie() { 
            foreach($_COOKIE as $key=>$value) { 
                $_COOKIE[$key] = addslashes($value); 
            } 
        } 
    } 
    
    $sanitizedData =& new sanitize(); 
    ?>

    http://www.phpclasses.org/browse/file/21488.html

    универсальная индусская обработка входных данных.
    юзер в безопасности!

    Lure Of Chaos, 09 Апреля 2011

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

    +160

    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
    <?php
    session_start();
    if(isset($_GET['gc'])){
    $s="";
    $s = rand(0,10).rand(0,10).rand(0,10).rand(0,10).rand(0,10).rand(0,10);
    $ct=mktime();
    $_SESSION['tm']=$ct;
    echo "<a href=\"http://netelis.hmsite.net/cg.php?cn=$s\">http://localhost/cg.php?cn=$s</a>";
      $_SESSION['ccc']=$s;
    } elseif(isset($_GET['cn']) && isset($_SESSION['tm'])){
      $tt=mktime();
      $dt=$tt-$_SESSION['tm'];
      if($dt<=25){
      if(isset($_SESSION['ccc'])){echo "<p align=center><FORM name=cp method=POST action=\"\"><br>"; echo $_SESSION['ccc']."<br>";echo "Enter the text you see<br>";}
      echo "<input name=cpt type=text>";
      echo "<input name=sub type=submit>";
      echo "</FORM></p>";} else {echo "The link was broken";};
    };
    if(isset($_POST['cpt'])){
    if(isset($_SESSION['ccc'])){
    if($_SESSION['ccc']==$_POST['cpt']){
    echo "Captcha is valid";
    
    };
    session_destroy();
    };
    
    };
    ?>

    Проверочный код

    AliceGoth, 09 Апреля 2011

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

    +171

    1. 1
    2. 2
    3. 3
    global $_GET,$_POST,$HTTP_POST_VARS,$HTTP_GET_VARS;
    if (!is_array($_GET)){$_GET=$HTTP_GET_VARS;}
    if (!is_array($_POST))$_GET=$HTTP_POST_VARS;

    NemoReturns, 08 Апреля 2011

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

    +164

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    tr>
                                <td valign="top">
                                  <!--Содержание станици начинается тут-->
    <?
    if ($p)
       include "content/pages.php";
    elseif ($mod)
       include "content/".$mod.".php";
    ?>
                                </td>
                              </tr>

    Так происходит подключение модулей на одном крупном гос.портале Казахстана. $mod передаётся через get подключение происходит без всяких проверок

    NemoReturns, 08 Апреля 2011

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    $val = $_POST["value"];
    $val = str_replace("e", "&#0101;", $val);
    $val = str_replace("E", "&#0069;", $val);
    mysql_query("insert into `table` (`value`) values '$val'");

    Это мы так спасаемся от mysql-инъекций.

    ling, 08 Апреля 2011

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

    +166

    1. 1
    $dctEvent =new EventData_IEM_ADDON_DYNAMICCONTENTTAGS_REPLACETAGCONTENT();

    Из одной системы мэйлмаркетинга. Там еще много ГК...

    rO_ot, 08 Апреля 2011

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

    +161

    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
    $tmpProduct = array(
    ...
        'FARE' => $tmpFares,
        '~FARE' => CTRSCurrency::GetStringFull($row['FARE'], $o['CURRENCY']),
        'TAX' => CTRSCurrency::GetString($row['TAX'], $o['CURRENCY']),
        '~TAX' => CTRSCurrency::GetStringFull($row['TAX'], $o['CURRENCY']),
    ...
    );
    
    ...
    	
    $tmpProduct['FARE_'] = $tmpProduct['~FARE'];
    $tmpProduct['TAX_'] = $tmpProduct['~TAX'];
    $tmpProduct['~FARE_'] = $row['FARE'];
    $tmpProduct['~TAX_'] = $row['TAX'];

    Из одного очень большего компонента...

    wwwguru, 08 Апреля 2011

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

    +161

    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
    //стандарт
    		$price_st = mysql_query("select price from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and  ves_do>= '$izmer' and `type`='$type_st' limit 1");
    		$price_st = mysql_result($price_st, 0);
    
    		$minprice_st = mysql_query("select minprice from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_st' limit 1");
    		$minprice_st = mysql_result($minprice_st, 0);
    		$time_st = mysql_query("select time from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_st' limit 1");
    		$time_st = mysql_result($time_st, 0);
    
    	//экспресс
    		$price_ex = mysql_query("select price from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and  ves_do>= '$izmer' and `type`='$type_ex' limit 1");
    		$price_ex = mysql_result($price_ex, 0);
    		$minprice_ex = mysql_query("select minprice from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_ex' limit 1");
    		$minprice_ex = mysql_result($minprice_ex, 0);
    		$time_ex = mysql_query("select time from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_ex' limit 1");
    		$time_ex = mysql_result($time_ex, 0);
    
    	//Ритейл
    		$price_pallet = mysql_query("select price from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$pallets' and  ves_do>= '$pallets' and `type`='$type_rit' limit 1");
    		$price_pallet = mysql_result($price_pallet, 0);
    
    		$time_pallet = mysql_query("select time from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$pallets' and ves_do >= '$pallets' and `type`='$type_rit' limit 1");
    		$time_pallet = mysql_result($time_pallet, 0);
    
    	//авиа
    		if ($start==getIdCity('Москва')){
    
    			if ($volume*167>$weight){
    				$izmer=(float)($volume*167);
    				$kol_av = $volume*167;
    			}
    			else
    			{
    				$izmer=$weight;
    				$kol_av = $weight;
    			}
    			$price_av = mysql_query("select price from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and  ves_do>= '$izmer' and `type`='$type_av' limit 1");
    			$price_av = mysql_result($price_av, 0);
    			$minprice_av = mysql_query("select minprice from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_av' limit 1");
    			$minprice_av = mysql_result($minprice_av, 0);
    			$time_av = mysql_query("select time from db_tarif where `from` = '$start' and `to` = '$finish' and ves_ot <= '$izmer' and ves_do >= '$izmer' and `type`='$type_av' limit 1");
    			$time_av = mysql_result($time_av, 0);
    		}
    		else{
    			$cost_av = "Тариф недоступен";
    		}

    калькулятор стоимости перевозки

    Shiz89, 08 Апреля 2011

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

    +163

    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
    $gun = 0;
    while ($gun < 10000000)
    {
     // Дохуя кода
     $gun++;
     if ( $win2 >= $casbank ) 
     {
      $gun = 12; 
     }
     else 
     {
      $gun = 13500000;               
     }
    }

    partizan22, 08 Апреля 2011

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