Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $allitems=array("001"=>"All Residential","1"=>"Residential Plot","2"=>"Residential House","3"=>"Multistorey"
- ,"4"=>"builder Floor Apparment"
- ,"5"=>"Service Aparment","6"=>"Villa","7"=>"Holiday Home","8"=>"Paying Guest",
- "9"=>"Hotel",
- "002"=>"All Commercial"
- ,"10"=>"Office In IT Park/SEZ","11"=>"Commercial Land","12"=>"Commercial Office space",
- "13"=>"Commercial Shop","14"=>"Cmmercial Showroom","15"=>"Kiosk","16"=>"Hotel",
- "17"=>"Hotel Sites",
- "18"=>"Guest House",
- "19"=>"Business Centre",
- "20"=>"Warehouse/ Godown",
- "21"=>"Industrial Land",
- "22"=>"Industrial Building",
- "23"=>"Industrial Shed"
- ,"003"=>"All Agriculture",
- "24"=>"Agricultural Land",
- "25"=>"Farm House");
- $subitems=array("1"=>"Residential Plot","2"=>"Residential House","3"=>"Multistorey"
- ,"4"=>"builder Floor Apparment"
- ,"5"=>"Service Aparment","6"=>"Villa","7"=>"Holiday Home","8"=>"Paying Guest",
- "9"=>"Hotel"
- ,"10"=>"Office In IT Park/SEZ","11"=>"Commercial Land","12"=>"Commercial Office space",
- "13"=>"Commercial Shop","14"=>"Cmmercial Showroom","15"=>"Kiosk","16"=>"Hotel",
- "17"=>"Hotel Sites",
- "18"=>"Guest House",
- "19"=>"Business Centre",
- "20"=>"Warehouse/ Godown",
- "21"=>"Industrial Land",
- "22"=>"Industrial Building",
- "23"=>"Industrial Shed",
- "24"=>"Agricultural Land",
- "25"=>"Farm House");
- $mainitems["1"]=array("1"=>"Residential Plot","2"=>"Residential House","3"=>"Multistorey"
- ,"4"=>"builder Floor Apparment"
- ,"5"=>"Service Aparment","6"=>"Villa","7"=>"Holiday Home","8"=>"Paying Guest",
- "9"=>"Hotel");
- $mainitems["2"]=array("10"=>"Office In IT Park/SEZ","11"=>"Commercial Land","12"=>"Commercial Office space",
- "13"=>"Commercial Shop","14"=>"Cmmercial Showroom","15"=>"Kiosk","16"=>"Hotel",
- "17"=>"Hotel Sites",
- "18"=>"Guest House",
- "19"=>"Business Centre",
- "20"=>"Warehouse/ Godown",
- "21"=>"Industrial Land",
- "22"=>"Industrial Building",
- "23"=>"Industrial Shed");
- $mainitems["3"]=array("24"=>"Agricultural Land",
- "25"=>"Farm House");
- $priceitems=array(
- "0"=>" ",
- "100000"=>"1 lac ",
- "500000"=>"5 lac ",
- "1000000"=>" 10 lac ",
- "2000000"=>"20 lac ",
- "3000000"=>"30 lac ",
- "4000000"=>"40 lac ",
- "5000000"=>"50 lac ",
- "6000000"=>"60 lac ",
- "7000000"=>"70 lac ",
- "8000000"=>"80 lac ",
- "9000000"=>"90 lac ",
- "10000000"=>"1 crores ",
- "12000000"=>"1.2 crores ",
- "14000000"=>"1.4 crores ",
- "16000000"=>"1.6 crores ",
- "18000000"=>"1.8 crores ",
- "20000000"=>"2 crores ",
- "23000000"=>"2.3 crores ",
- "26000000"=>"2.6 crores ",
- "30000000"=>"3 crores ",
- "33000000"=>"3.3 crores ",
- "36000000"=>"3.6 crores ",
- "40000000"=>"4 crores ");
- $minroom=$maxroom=1;
- $location="";
- $vcat=false;
- $vfor=false;
- $vscat=false;
- $vminroom=false;
- $vmaxroom=false;
- $vlocation=false;
- $vpricemin=false;
- $vpricemax=false;
- if(isset($_GET['minroom']) && get_value_checker($_GET['minroom'])) {$vminroom=true; $minroom=$_GET['minroom']; }
- if(isset($_GET['for'])) {$vfor=true; $for= htmlentities($_GET['for']); }
- if(isset($_GET['location'])){ $vlocation=true; $location= htmlentities($_GET['location']);}
- if(isset($_GET['maxroom']) && get_value_checker($_GET['maxroom'])) {$vmaxroom=true; $maxroom=$_GET['maxroom']; }
- if(isset($_GET['pricemin']) && get_value_checker($_GET['pricemin'])) {$vpricemin=true; $pricemin=$_GET['pricemin']; }
- if(isset($_GET['pricemax']) && get_value_checker($_GET['pricemax'])) {$vpricemax=true; $pricemax=$_GET['pricemax']; }
- $myurl=root."postsearch.php?type=search";
- if($vlocation){
- $myurl.=("&location=".urlencode($location));
- }
- if($vpricemin){
- $myurl.=("&pricemin=".(int)($pricemin));
- }
- if($vpricemax){
- $myurl.=("&pricemax=".(int)($pricemax));
- }
- if($vfor){
- $myurl.=("&for=".urlencode($for));
- }
- if(isset($_GET['cat']) && get_value_checker($_GET['cat']) && $_GET['cat']<=count($mainitems)){
- $vcat=true;
- $cat=(int)$_GET['cat'];
- }
- else{
- if(isset($_GET['scat']) && get_value_checker($_GET['scat']) && $_GET['scat']<=count($subitems)){
- switch ($_GET['scat']){
- case $_GET['scat']< count($mainitems[1]):$cat=1;
- break;
- case $_GET['scat']<count($mainitems[2]):$cat=2;
- break;
- case $_GET['scat']<count($mainitems[3]):$cat=3;
- break;
- default :$cat=1;
- }
- }else{
- $cat=1;
- }
- }
- if(isset($_GET['scat']) && get_value_checker($_GET['scat']) && $_GET['scat']<=count($subitems)) {
- $scat=(int)$_GET['scat'];
- $vscat=true;
- } else{
- $scat=-1;
- }
- if($vcat){
- $myurl.="&cat=".$cat;
- }
- if($vscat){
- $myurl.="&scat=".$scat;
- }
- $query="SELECT * FROM house ";
- $spricemin= isset($_GET['pricemin'])? !get_value_checker($_GET['pricemin'])?false:true:false;
- $spricemax= isset($_GET['pricemax'])? !get_value_checker($_GET['pricemax'])?false:true:false;
- $slocation= isset($_GET['location'])? $_GET['location']==''?false:true:false;
- $stype= isset($_GET['cat'])? !get_value_checker($_GET['cat'])?false:true:false;
- $sctype= isset($_GET['scat'])? !get_value_checker($_GET['scat'])?false:true:false;
- $sminbed= isset($_GET['minroom'])? !get_value_checker($_GET['minroom'])?false:true:false;
- $smaxroom= isset($_GET['maxroom'])? !get_value_checker($_GET['maxroom'])?false:true:false;
- $sfor= isset($_GET['for'])? $_GET['for']==''?false:true:false;
- if( $slocation ||$sminbed || $spricemax ||$spricemin ||$stype || $sctype || $sminbed || $smaxroom || $sfor){
- $query.=" WHERE ^";
- }else {
- $query.=" WHERE 1^";
- }
- $p=array();
- if($spricemin){
- $query.="main_price>:minprice &";
- $p[":minprice"]=$_GET['pricemin'];
- }
- if($spricemax){
- $query.="main_price<:maxprice &";
- $p[":maxprice"]=$_GET['pricemax'];
- }
- if($slocation){
- $query.="main_location LIKE :loc &";
- $p[":loc"]='%'.$_GET['location'].'%';
- }
- if($sminbed){
- $query.="main_totalroom>=:minbed &";
- $p[":minbed"]=$_GET['minroom'];
- }
- if($smaxroom){
- $query.="main_totalroom<=:maxroom &";
- $p[":maxroom"]=$_GET['maxroom'];
- }
- if($stype){
- $query.="main_type=:type &";
- $p[":type"]=$_GET['cat'];
- }
- if($sctype){
- $query.="main_subtype=:stype &";
- $p[":stype"]=$_GET['scat'];
- }
- if($sfor){
- $query.="main_for=:for &";
- $p[":for"]=$_GET['for'];
- }
- $a=explode("^",$query);
- $q= (implode(" AND ", explode("&",$a[1])));
- $b=substr($q,0,strlen($q)-4);
- $newquery=$a[0].$b;
- $search=$database->query($newquery,$p);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement