fork download
  1. <?
  2. if(isset($_POST))
  3. {
  4. $id_catalog=0;
  5. $id_region=0;
  6. $name_reg='all';
  7. $name_cat='all';
  8.  
  9. for($i=0; $i<4; $i++)
  10. {
  11. if(isset($_POST['razdel_'.$i])) $id_catalog=intval($_POST['razdel_'.$i]);
  12. if(isset($_POST['razdel_'.$i])) unset($_POST['razdel_'.$i]);
  13.  
  14. if(isset($_POST['region_'.$i])) $id_region=intval($_POST['region_'.$i]);
  15. if(isset($_POST['region_'.$i])) unset($_POST['region_'.$i]);
  16.  
  17. if(isset($_POST['name_reg_'.$i])) $name_reg=$_POST['name_reg_'.$i];
  18. if(isset($_POST['name_reg_'.$i])) unset($_POST['name_reg_'.$i]);
  19.  
  20. if(isset($_POST['name_cat_'.$i])) $name_cat=$_POST['name_cat_'.$i];
  21. if(isset($_POST['name_cat_'.$i])) unset($_POST['name_cat_'.$i]);
  22.  
  23. if(isset($_POST['zapros_q'])) unset($_POST['zapros_q']);
  24. }
  25.  
  26.  
  27. if(isset($_POST['text_search']))
  28. {
  29. function _pred ($a)
  30. {
  31. $a=strip_tags($a);
  32. $a=str_replace("`","",$a);
  33. $a=str_replace("'","",$a);
  34. $a=str_replace('"',"",$a);
  35. $a=str_replace("&","",$a);
  36. $a=str_replace("=","",$a);
  37. $a=str_replace('javascript',"",$a);
  38. $a=trim($a);
  39. $a=urlencode($a);
  40. return $a;
  41. }
  42. $_POST['text_search']=_pred ($_POST['text_search']);
  43. }
  44.  
  45. if(!$_POST['text_search'] && $_POST['sz']) unset($_POST['sz']);
  46.  
  47. if($_POST['id_firm'])
  48. $per='_'.$_POST['id_firm'].'/';
  49. else
  50. $per='catalog/';
  51.  
  52. if($id_catalog || $id_region)
  53. $adres=$per.$name_cat."_".$id_catalog."/".$name_reg."_".$id_region."/";
  54. else
  55. $adres=$per;
  56.  
  57. $no_index_arr = array(
  58. "id_firm",
  59. "submit",
  60. "submit_x",
  61. "submit_y"
  62. );
  63.  
  64. $zapros="";
  65. $i=0;
  66. foreach($_POST as $index=>$po)
  67. {
  68. if(is_array($po))
  69. {
  70. foreach($po as $ind=>$p)
  71. {
  72. if($p)
  73. {
  74. if($i)
  75. $zapros .= "&";
  76. $zapros .= $index."[".$ind."]=".$p;
  77. $i++;
  78. }
  79. }
  80. }
  81. else
  82. {
  83. if($po && !in_array($index, $no_index_arr))
  84. {
  85. if($i)
  86. $zapros .= "&";
  87. $zapros .= $index."=".$po;
  88. $i++;
  89. }
  90. }
  91. }
  92.  
  93. if($zapros)
  94. $adr=$adres."param_".$zapros;
  95. else
  96. $adr=$adres;
  97. }
  98. else
  99. $adr='catalog/';
  100.  
  101. @header ("Location: ".$adr);
  102. //echo "<HTML><HEAD><meta http-equiv='Refresh' charset='utf-8' content='0; URL=".$adr."'></HEAD></HTML>";
  103.  
  104. ?>
  105.  
Success #stdin #stdout 0.04s 25376KB
stdin
Standard input is empty
stdout
<?
if(isset($_POST))
{
$id_catalog=0;
$id_region=0;
$name_reg='all';
$name_cat='all';

for($i=0; $i<4; $i++)
	{
	if(isset($_POST['razdel_'.$i])) $id_catalog=intval($_POST['razdel_'.$i]);
	if(isset($_POST['razdel_'.$i])) unset($_POST['razdel_'.$i]);
	
	if(isset($_POST['region_'.$i])) $id_region=intval($_POST['region_'.$i]);
	if(isset($_POST['region_'.$i])) unset($_POST['region_'.$i]);
	
	if(isset($_POST['name_reg_'.$i])) $name_reg=$_POST['name_reg_'.$i];
	if(isset($_POST['name_reg_'.$i])) unset($_POST['name_reg_'.$i]);
	
	if(isset($_POST['name_cat_'.$i])) $name_cat=$_POST['name_cat_'.$i];
	if(isset($_POST['name_cat_'.$i])) unset($_POST['name_cat_'.$i]);
	
	if(isset($_POST['zapros_q'])) unset($_POST['zapros_q']);
	}
	
	
if(isset($_POST['text_search']))
	{
	function _pred ($a)
		{
		$a=strip_tags($a);
		$a=str_replace("`","",$a);
		$a=str_replace("'","",$a);
		$a=str_replace('"',"",$a);
		$a=str_replace("&","",$a);
		$a=str_replace("=","",$a);
		$a=str_replace('javascript',"",$a);
		$a=trim($a);
		$a=urlencode($a);
		return $a;
		}
	$_POST['text_search']=_pred ($_POST['text_search']);
	}	

if(!$_POST['text_search'] && $_POST['sz']) unset($_POST['sz']);
	
if($_POST['id_firm'])	
$per='_'.$_POST['id_firm'].'/';
else
$per='catalog/';
	
if($id_catalog || $id_region)
$adres=$per.$name_cat."_".$id_catalog."/".$name_reg."_".$id_region."/";
else
$adres=$per;

$no_index_arr = array(
"id_firm",
"submit",
"submit_x", 
"submit_y"
);

$zapros="";
$i=0;
foreach($_POST as $index=>$po)
	{
	if(is_array($po))
		{
		foreach($po as $ind=>$p)
			{
			if($p)
				{
				if($i)
				$zapros .= "&";
				$zapros .= $index."[".$ind."]=".$p;
				$i++;
				}
			}
		}
	else 
		{
		if($po && !in_array($index, $no_index_arr))
			{
			if($i)
			$zapros .= "&";
			$zapros .= $index."=".$po;
			$i++;
			}
		}
	}

if($zapros) 
$adr=$adres."param_".$zapros;
else 
$adr=$adres;
}
else 
$adr='catalog/';

@header ("Location: ".$adr);
//echo "<HTML><HEAD><meta http-equiv='Refresh' charset='utf-8' content='0; URL=".$adr."'></HEAD></HTML>";

?>