Advertisement
Guest User

Untitled

a guest
Feb 27th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.11 KB | None | 0 0
  1. $allitems=array("001"=>"All Residential","1"=>"Residential Plot","2"=>"Residential House","3"=>"Multistorey"
  2. ,"4"=>"builder Floor Apparment"
  3. ,"5"=>"Service Aparment","6"=>"Villa","7"=>"Holiday Home","8"=>"Paying Guest",
  4. "9"=>"Hotel",
  5. "002"=>"All Commercial"
  6. ,"10"=>"Office In IT Park/SEZ","11"=>"Commercial Land","12"=>"Commercial Office space",
  7. "13"=>"Commercial Shop","14"=>"Cmmercial Showroom","15"=>"Kiosk","16"=>"Hotel",
  8. "17"=>"Hotel Sites",
  9. "18"=>"Guest House",
  10. "19"=>"Business Centre",
  11. "20"=>"Warehouse/ Godown",
  12. "21"=>"Industrial Land",
  13. "22"=>"Industrial Building",
  14. "23"=>"Industrial Shed"
  15. ,"003"=>"All Agriculture",
  16. "24"=>"Agricultural Land",
  17. "25"=>"Farm House");
  18. $subitems=array("1"=>"Residential Plot","2"=>"Residential House","3"=>"Multistorey"
  19. ,"4"=>"builder Floor Apparment"
  20. ,"5"=>"Service Aparment","6"=>"Villa","7"=>"Holiday Home","8"=>"Paying Guest",
  21. "9"=>"Hotel"
  22. ,"10"=>"Office In IT Park/SEZ","11"=>"Commercial Land","12"=>"Commercial Office space",
  23. "13"=>"Commercial Shop","14"=>"Cmmercial Showroom","15"=>"Kiosk","16"=>"Hotel",
  24. "17"=>"Hotel Sites",
  25. "18"=>"Guest House",
  26. "19"=>"Business Centre",
  27. "20"=>"Warehouse/ Godown",
  28. "21"=>"Industrial Land",
  29. "22"=>"Industrial Building",
  30. "23"=>"Industrial Shed",
  31. "24"=>"Agricultural Land",
  32. "25"=>"Farm House");
  33. $mainitems["1"]=array("1"=>"Residential Plot","2"=>"Residential House","3"=>"Multistorey"
  34. ,"4"=>"builder Floor Apparment"
  35. ,"5"=>"Service Aparment","6"=>"Villa","7"=>"Holiday Home","8"=>"Paying Guest",
  36. "9"=>"Hotel");
  37. $mainitems["2"]=array("10"=>"Office In IT Park/SEZ","11"=>"Commercial Land","12"=>"Commercial Office space",
  38. "13"=>"Commercial Shop","14"=>"Cmmercial Showroom","15"=>"Kiosk","16"=>"Hotel",
  39. "17"=>"Hotel Sites",
  40. "18"=>"Guest House",
  41. "19"=>"Business Centre",
  42. "20"=>"Warehouse/ Godown",
  43. "21"=>"Industrial Land",
  44. "22"=>"Industrial Building",
  45. "23"=>"Industrial Shed");
  46. $mainitems["3"]=array("24"=>"Agricultural Land",
  47. "25"=>"Farm House");
  48. $priceitems=array(
  49. "0"=>" ",
  50. "100000"=>"1 lac ",
  51. "500000"=>"5 lac ",
  52. "1000000"=>" 10 lac ",
  53. "2000000"=>"20 lac ",
  54. "3000000"=>"30 lac ",
  55. "4000000"=>"40 lac ",
  56. "5000000"=>"50 lac ",
  57. "6000000"=>"60 lac ",
  58. "7000000"=>"70 lac ",
  59. "8000000"=>"80 lac ",
  60. "9000000"=>"90 lac ",
  61. "10000000"=>"1 crores ",
  62. "12000000"=>"1.2 crores ",
  63. "14000000"=>"1.4 crores ",
  64. "16000000"=>"1.6 crores ",
  65. "18000000"=>"1.8 crores ",
  66. "20000000"=>"2 crores ",
  67. "23000000"=>"2.3 crores ",
  68. "26000000"=>"2.6 crores ",
  69. "30000000"=>"3 crores ",
  70. "33000000"=>"3.3 crores ",
  71. "36000000"=>"3.6 crores ",
  72. "40000000"=>"4 crores ");
  73.  
  74.  
  75. $minroom=$maxroom=1;
  76. $location="";
  77. $vcat=false;
  78. $vfor=false;
  79. $vscat=false;
  80. $vminroom=false;
  81. $vmaxroom=false;
  82. $vlocation=false;
  83. $vpricemin=false;
  84. $vpricemax=false;
  85. if(isset($_GET['minroom']) && get_value_checker($_GET['minroom'])) {$vminroom=true; $minroom=$_GET['minroom']; }
  86. if(isset($_GET['for'])) {$vfor=true; $for= htmlentities($_GET['for']); }
  87. if(isset($_GET['location'])){ $vlocation=true; $location= htmlentities($_GET['location']);}
  88. if(isset($_GET['maxroom']) && get_value_checker($_GET['maxroom'])) {$vmaxroom=true; $maxroom=$_GET['maxroom']; }
  89. if(isset($_GET['pricemin']) && get_value_checker($_GET['pricemin'])) {$vpricemin=true; $pricemin=$_GET['pricemin']; }
  90. if(isset($_GET['pricemax']) && get_value_checker($_GET['pricemax'])) {$vpricemax=true; $pricemax=$_GET['pricemax']; }
  91.  
  92. $myurl=root."postsearch.php?type=search";
  93. if($vlocation){
  94. $myurl.=("&location=".urlencode($location));
  95. }
  96. if($vpricemin){
  97. $myurl.=("&pricemin=".(int)($pricemin));
  98. }
  99. if($vpricemax){
  100. $myurl.=("&pricemax=".(int)($pricemax));
  101. }
  102. if($vfor){
  103. $myurl.=("&for=".urlencode($for));
  104. }
  105.  
  106.  
  107. if(isset($_GET['cat']) && get_value_checker($_GET['cat']) && $_GET['cat']<=count($mainitems)){
  108. $vcat=true;
  109. $cat=(int)$_GET['cat'];
  110. }
  111. else{
  112. if(isset($_GET['scat']) && get_value_checker($_GET['scat']) && $_GET['scat']<=count($subitems)){
  113. switch ($_GET['scat']){
  114. case $_GET['scat']< count($mainitems[1]):$cat=1;
  115. break;
  116. case $_GET['scat']<count($mainitems[2]):$cat=2;
  117. break;
  118. case $_GET['scat']<count($mainitems[3]):$cat=3;
  119. break;
  120. default :$cat=1;
  121. }
  122. }else{
  123. $cat=1;
  124. }
  125. }
  126. if(isset($_GET['scat']) && get_value_checker($_GET['scat']) && $_GET['scat']<=count($subitems)) {
  127. $scat=(int)$_GET['scat'];
  128. $vscat=true;
  129. } else{
  130. $scat=-1;
  131. }
  132. if($vcat){
  133. $myurl.="&cat=".$cat;
  134. }
  135. if($vscat){
  136. $myurl.="&scat=".$scat;
  137. }
  138. $query="SELECT * FROM house ";
  139. $spricemin= isset($_GET['pricemin'])? !get_value_checker($_GET['pricemin'])?false:true:false;
  140. $spricemax= isset($_GET['pricemax'])? !get_value_checker($_GET['pricemax'])?false:true:false;
  141. $slocation= isset($_GET['location'])? $_GET['location']==''?false:true:false;
  142. $stype= isset($_GET['cat'])? !get_value_checker($_GET['cat'])?false:true:false;
  143. $sctype= isset($_GET['scat'])? !get_value_checker($_GET['scat'])?false:true:false;
  144. $sminbed= isset($_GET['minroom'])? !get_value_checker($_GET['minroom'])?false:true:false;
  145. $smaxroom= isset($_GET['maxroom'])? !get_value_checker($_GET['maxroom'])?false:true:false;
  146. $sfor= isset($_GET['for'])? $_GET['for']==''?false:true:false;
  147. if( $slocation ||$sminbed || $spricemax ||$spricemin ||$stype || $sctype || $sminbed || $smaxroom || $sfor){
  148. $query.=" WHERE ^";
  149. }else {
  150. $query.=" WHERE 1^";
  151. }
  152. $p=array();
  153. if($spricemin){
  154. $query.="main_price>:minprice &";
  155. $p[":minprice"]=$_GET['pricemin'];
  156. }
  157. if($spricemax){
  158. $query.="main_price<:maxprice &";
  159. $p[":maxprice"]=$_GET['pricemax'];
  160. }
  161. if($slocation){
  162. $query.="main_location LIKE :loc &";
  163. $p[":loc"]='%'.$_GET['location'].'%';
  164. }
  165. if($sminbed){
  166. $query.="main_totalroom>=:minbed &";
  167. $p[":minbed"]=$_GET['minroom'];
  168. }
  169. if($smaxroom){
  170. $query.="main_totalroom<=:maxroom &";
  171. $p[":maxroom"]=$_GET['maxroom'];
  172. }
  173. if($stype){
  174. $query.="main_type=:type &";
  175. $p[":type"]=$_GET['cat'];
  176. }
  177. if($sctype){
  178. $query.="main_subtype=:stype &";
  179. $p[":stype"]=$_GET['scat'];
  180. }
  181. if($sfor){
  182. $query.="main_for=:for &";
  183. $p[":for"]=$_GET['for'];
  184. }
  185. $a=explode("^",$query);
  186. $q= (implode(" AND ", explode("&",$a[1])));
  187. $b=substr($q,0,strlen($q)-4);
  188. $newquery=$a[0].$b;
  189. $search=$database->query($newquery,$p);
  190. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement