PageRenderTime 66ms CodeModel.GetById 31ms RepoModel.GetById 1ms app.codeStats 0ms

/cityapp.php

https://bitbucket.org/Yatindra_Mohite/city_app_indore
PHP | 2240 lines | 1437 code | 737 blank | 66 comment | 161 complexity | 16cddd7fa69b0698ddbc014f4a2fbcd1 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. error_reporting(0);
  3. $base_url = 'http://base3.engineerbabu.com:8282/city_app_indore/';
  4. define("base_url", $base_url);
  5. Init();
  6. class funcs_code
  7. {
  8. var $conn="";
  9. var $dba="city_app";
  10. var $host="localhost";
  11. var $user="root";
  12. var $pass="Engi@@rBabu";
  13. public function connection()
  14. {
  15. $this->conn = mysql_connect($this->host,$this->user,$this->pass) or die(mysql_error());
  16. $this->dba = mysql_select_db($this->dba,$this->conn) or die(mysql_error());
  17. }
  18. }
  19. function Init()
  20. {
  21. $method = $_GET['method'];
  22. if($method== "SignIn"){
  23. SignIn();
  24. }elseif($method=="SignUp"){
  25. SignUp();
  26. }elseif($method=="SocialSignIn"){
  27. SocialSignIn();
  28. }elseif($method=="ForgotPassword"){
  29. ForgotPassword();
  30. }elseif($method=="ChangePassword"){
  31. ChangePassword();
  32. }elseif($method=="GetRestaurantDhabaTiffin"){
  33. GetRestaurantDhabaTiffin();
  34. }elseif($method=="GetBank"){
  35. GetBank();
  36. }elseif($method=="GetFitness"){
  37. GetFitness();
  38. }elseif($method=="GetHospital"){
  39. GetHospital();
  40. }elseif($method=="GetHostel"){
  41. GetHostel();
  42. }elseif($method=="GetProperty"){
  43. GetProperty();
  44. }elseif($method=="GetTransport"){
  45. GetTransport();
  46. }elseif($method=="GetEducation"){
  47. GetEducation();
  48. }elseif($method=="GetAtm"){
  49. GetAtm();
  50. }elseif($method=="GetPetrolpump"){
  51. GetPetrolpump();
  52. }elseif($method=="GetPlaces"){
  53. GetPlaces();
  54. }elseif($method=="GetJob"){
  55. GetJob();
  56. }elseif($method=="GetPolice"){
  57. GetPolice();
  58. }elseif($method=="UserProfileUpdate"){
  59. UserProfileUpdate();
  60. }elseif($method=="Homedelivery"){
  61. Homedelivery();
  62. }elseif($method=="Popularinindore"){
  63. Popularinindore();
  64. }elseif($method=="AddRating"){
  65. AddRating();
  66. }elseif($method=="NotificationOnOff"){
  67. NotificationOnOff();
  68. }elseif($method=="Gallary"){
  69. Gallary();
  70. }elseif($method=="GetEvent"){
  71. GetEvent();
  72. }elseif($method=="GetAllDataBySearch"){
  73. GetAllDataBySearch();
  74. }elseif($method=="GetAllData"){
  75. GetAllData();
  76. }elseif($method=="Trending"){
  77. Trending();
  78. }elseif($method=="Banner"){
  79. Banner();
  80. }elseif($method=="hitcounter"){
  81. hitcounter();
  82. }elseif($method=="AppVersion"){
  83. AppVersion();
  84. }
  85. }
  86. function SignIn()
  87. {
  88. $obj=new funcs_code();
  89. $obj->connection();
  90. $email= $_REQUEST['email'];
  91. $password = md5($_REQUEST['password']);
  92. $device_token = $_REQUEST['device_token'];
  93. $sql = "SELECT * FROM `user` WHERE `email`= '$email' AND `password`= '$password'";
  94. $res = mysql_query($sql);
  95. $contents['result'] = 'failed';
  96. if(mysql_num_rows($res)>0)
  97. {
  98. $queRow = mysql_fetch_assoc($res);
  99. $user_id=$queRow['id'];
  100. $image1 = $queRow['image'];
  101. $image = base_url.$image1;
  102. $sql11=mysql_query("UPDATE `user` SET `device_token`='$device_token' WHERE`id`='$user_id'");
  103. $arr=array('user_id'=>$queRow['id'],
  104. 'username'=>$queRow['username'],
  105. 'email'=>$queRow['email'],
  106. 'mobile'=>$queRow['mobile'],
  107. 'company_name'=>$queRow['company_name'],
  108. 'image'=>$image);
  109. $contents['result'] = 'successfull';
  110. $contents['info'] = $arr;
  111. }
  112. else
  113. {
  114. $contents['result'] = 'email and password not matched';
  115. }
  116. header("content-type: application/json");
  117. echo json_encode($contents);
  118. }
  119. function SignUp(){
  120. $obj=new funcs_code();
  121. $obj->connection();
  122. $output = "";
  123. $username= ($_REQUEST['username']);
  124. $email = $_REQUEST['email'];
  125. $password= md5($_REQUEST['password']);
  126. $mobile= $_REQUEST['mobile'];
  127. $company_name= $_REQUEST['company_name'];
  128. $device_token= $_REQUEST['device_token'];
  129. //$device_type= $_REQUEST['device_type'];
  130. $contents['result'] = 'failed';
  131. $sql = "SELECT * FROM `user` WHERE `email` = '$email' ";
  132. $res = mysql_query($sql);
  133. if(mysql_num_rows($res)>0)
  134. {
  135. while($result = mysql_fetch_assoc($res))
  136. {
  137. if($result['email'] == $email)
  138. {
  139. $contents['result'] = 'Email Already Exist';
  140. }
  141. }
  142. }
  143. else
  144. {
  145. $q = "INSERT INTO `user`(username,email,password,create_at,mobile,company_name,device_token) VALUES ('$username','$email','$password',CURRENT_TIMESTAMP,'$mobile','$company_name','$device_token')";
  146. if(mysql_query($q))
  147. {
  148. $id = mysql_insert_id();
  149. $sql1 = "SELECT * FROM `user` WHERE `id`= '$id'";
  150. $res1 = mysql_query($sql1);
  151. while($queRow = mysql_fetch_assoc($res1))
  152. {
  153. $arr=array('user_id'=>$queRow['id'],'username'=>$queRow['username'],'email'=>$queRow['email'],'mobile'=>$queRow['mobile'],'company_name'=>$queRow['company_name']);
  154. $contents['result'] = 'successfull';
  155. $contents['info'] =$arr;
  156. }
  157. }
  158. }
  159. header("content-type: application/json");
  160. echo json_encode($contents);
  161. }
  162. function SocialSignIn(){
  163. $obj=new funcs_code();
  164. $obj->connection();
  165. $contents['result'] = 'failed';
  166. $name= $_REQUEST['name'];
  167. $email = $_REQUEST['email'];
  168. $address = $_REQUEST['address'];
  169. $image= $_REQUEST['image'];
  170. $gender= $_REQUEST['gender'];
  171. $place = $_REQUEST['place'];
  172. $fb_id = $_REQUEST['fb_id'];
  173. $dob = $_REQUEST['dob'];
  174. $work = $_REQUEST['work'];
  175. $education = $_REQUEST['education'];
  176. $job_seeker = $_REQUEST['job_seeker'];
  177. $job_provider = $_REQUEST['job_provider'];
  178. $device_token = $_REQUEST['device_token'];
  179. $device_type = $_REQUEST['device_type'];
  180. $sql = mysql_query("SELECT * FROM `user` WHERE email = '$email'");
  181. if(mysql_num_rows($sql)>0)
  182. {
  183. $q=mysql_query("UPDATE `user` SET `name`='$name',`address`='$address',`image`='$image',`place`='$place',`email`='$email',`dob`='$dob',`work`='$work',`education`='$education',`device_token`='$device_token',`device_type`='$device_type' WHERE email = '$email'");
  184. if($q)
  185. {
  186. $sql1 = "SELECT * FROM `user` WHERE email = '$email'";
  187. $res1 = mysql_query($sql1);
  188. while($queRow = mysql_fetch_assoc($res1))
  189. {
  190. $arr=array('user_id'=>$queRow['id'],'name'=>$queRow['name'],'email'=>$queRow['email'],'address'=>$queRow['address'],'image'=>$queRow['image'],'place'=>$queRow['place'],'dob'=>$queRow['dob'],'work'=>$queRow['work'],'education'=>$queRow['education'],'job_seeker'=>$queRow['job_seeker'],'job_provider'=>$queRow['job_provider'],'mobile'=>$queRow['mobile'],'company_name'=>$queRow['company_name'],'resume'=>$queRow['resume']);
  191. $contents['info'] =$arr;
  192. $sql = mysql_query("SELECT * FROM `push_notification` WHERE `email` = '$email' ");
  193. if(mysql_num_rows($sql)>0)
  194. {
  195. $update_token = mysql_query("UPDATE `push_notification` SET `device_token`='$device_token' WHERE `email`='$email'");
  196. $contents['result'] = 'successfull';
  197. }
  198. else
  199. {
  200. $insert_token = mysql_query("INSERT INTO `push_notification`(`device_token`,`email`) VALUES('$device_token','$email')");
  201. $contents['result'] = 'successfull';
  202. }
  203. }
  204. }
  205. }
  206. else
  207. {
  208. $q = "INSERT INTO `user`(name,email,address,create_at,image,place,fb_id,dob,work,education,job_seeker,job_provider,device_token,device_type)VALUES ('$name','$email','$address',CURRENT_TIMESTAMP,'$image','$place','$fb_id','$dob','$work','$education','NO','NO','$device_token','$device_type')";
  209. if(mysql_query($q))
  210. {
  211. $id = mysql_insert_id();
  212. $sql1 = "SELECT * FROM `user` WHERE `id`= '$id'";
  213. $res1 = mysql_query($sql1);
  214. while($queRow = mysql_fetch_assoc($res1))
  215. {
  216. $arr=array('user_id'=>$queRow['id'],'name'=>$queRow['name'],'email'=>$queRow['email'],'address'=>$queRow['address'],'image'=>$queRow['image'],'place'=>$queRow['place'],'dob'=>$queRow['dob'],'work'=>$queRow['work'],'education'=>$queRow['education'],'job_seeker'=>$queRow['job_seeker'],'job_provider'=>$queRow['job_provider'],'mobile'=>$queRow['mobile'],'company_name'=>$queRow['company_name'],'resume'=>$queRow['resume']);
  217. $contents['info'] =$arr;
  218. $sql = mysql_query("SELECT * FROM `push_notification` WHERE `email` = '$email' ");
  219. if(mysql_num_rows($sql)>0)
  220. {
  221. $update_token = mysql_query("UPDATE `push_notification` SET `device_token`='$device_token' WHERE `email`='$email'");
  222. $contents['result'] = 'successfull';
  223. }
  224. else
  225. {
  226. $insert_token = mysql_query("INSERT INTO `push_notification`(`device_token`,`email`) VALUES('$device_token','$email')");
  227. $contents['result'] = 'successfull';
  228. }
  229. }
  230. }
  231. }
  232. header("content-type: application/json");
  233. echo json_encode($contents);
  234. }
  235. function ForgotPassword()
  236. {
  237. $obj=new funcs_code();
  238. $obj->connection();
  239. $email = ($_REQUEST['email']);
  240. $sql = "SELECT * FROM `user` WHERE email = '$email' ";
  241. $res = mysql_query($sql);
  242. $contents['result'] = 'Email Not Found';
  243. if(mysql_num_rows($res)>0)
  244. {
  245. while($result = mysql_fetch_assoc($res))
  246. {
  247. $id = $result['id'];
  248. $password = $result['password'];
  249. $num = substr(randomPassword(),0,6);
  250. $subject = "City App: Forget Password";
  251. $msg = "City App New Password is $num<br/><br/>";
  252. $headers = 'MIME-Version: 1.0' . "\r\n";
  253. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  254. $headers .= 'From: No Reply <no-reply@indorecityapp.com>';
  255. @mail($email, $subject, $msg, $headers);
  256. $password= md5($num);
  257. $sql1= "UPDATE `user` SET `password`='$password' WHERE `id`='$id' ";
  258. $f=mysql_query($sql1);
  259. if($f)
  260. {
  261. $contents['result'] = 'Password sent to your email';
  262. }
  263. }
  264. }
  265. header("content-type: application/json");
  266. echo json_encode($contents);
  267. }
  268. function randomPassword() {
  269. $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
  270. $pass = array(); /*remember to declare $pass as an array*/
  271. $alphaLength = strlen($alphabet) - 1; /*put the length -1 in cache*/
  272. for ($i = 0; $i < 6; $i++) {
  273. $n = rand(0, $alphaLength);
  274. $pass[] = $alphabet[$n];
  275. }
  276. return implode($pass); /*turn the array into a string*/
  277. }
  278. function ChangePassword()
  279. {
  280. $obj=new funcs_code();
  281. $obj->connection();
  282. $user_id= $_REQUEST['user_id'];
  283. $newpassword= md5($_REQUEST['newpassword']);
  284. $oldpassword= md5($_REQUEST['oldpassword']);
  285. $sql = "SELECT * FROM `user` WHERE `id`='$user_id' AND `password`='$oldpassword'";
  286. $res = mysql_query($sql);
  287. $contents['result'] = 'Old Password not match';
  288. if(mysql_num_rows($res)>0)
  289. {
  290. $sql1 = "UPDATE `user` SET `password`= '$newpassword' WHERE `id`='$user_id'";
  291. $res1 = mysql_query($sql1);
  292. if($res1)
  293. {
  294. $contents['result'] = 'Password Changed Successfully';
  295. }
  296. }
  297. header("content-type: application/json");
  298. echo json_encode($contents);
  299. }
  300. function Activate()
  301. {
  302. $obj = new funcs_code();
  303. $obj->connection();
  304. $user_id= $_REQUEST['abcd123456abc'];
  305. $q1="UPDATE `user` SET `mail_verify`='1' WHERE `id`='$user_id'";
  306. $flag1=mysql_query($q1);
  307. if($flag1)
  308. {
  309. $content['result']="verified successfully";
  310. }
  311. else
  312. {
  313. $content['result']="Failed";
  314. }
  315. header("content-type: application/json");
  316. echo json_encode($content);
  317. }
  318. function distance($lat1, $lon1, $lat2, $lon2, $unit)
  319. {
  320. $theta = $lon1 - $lon2;
  321. $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
  322. $dist = acos($dist);
  323. $dist = rad2deg($dist);
  324. $miles = $dist * 60 * 1.1515;
  325. $unit = strtoupper($unit);
  326. if ($unit == "K") {
  327. return ($miles * 1.609344);
  328. } else if ($unit == "N") {
  329. return ($miles * 0.8684);
  330. } else {
  331. return $miles;
  332. }
  333. }
  334. function GetRestaurantDhabaTiffin(){
  335. $obj=new funcs_code();
  336. $obj->connection();
  337. $category = $_REQUEST['category'];
  338. $area = $_REQUEST['area'];
  339. $long = $_REQUEST['long'];
  340. $lat = $_REQUEST['lat'];
  341. $sele_res = mysql_query("SELECT * FROM `restaurant_dhaba_tiffin` where `speciality`='$category' AND `area`='$area' ORDER BY `id` DESC");
  342. $contents = array();
  343. if(mysql_num_rows($sele_res)>0)
  344. {
  345. while($queRow = mysql_fetch_assoc($sele_res))
  346. {
  347. $id = $queRow['id'];
  348. $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
  349. $r = mysql_query($ave);
  350. $res = mysql_fetch_array($r);
  351. $rating=$res['avgrate'];
  352. if($rating == null)
  353. {
  354. $rating = 0;
  355. }
  356. //$base_url = "http://base3.engineerbabu.com/city_app_admin/";
  357. $image = base_url.$queRow['icon'];
  358. $sel= "select * from speciality where id = '".$queRow['speciality']."'";
  359. $r = mysql_query($sel);
  360. $res=mysql_fetch_array($r);
  361. $cate = $res['name'];
  362. $sel1= "select * from area where id = '".$queRow['area']."'";
  363. $r1 = mysql_query($sel1);
  364. $res1=mysql_fetch_array($r1);
  365. $area = $res1['name'];
  366. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  367. $dis=round($dis_cal,2);
  368. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'description'=>$queRow['description'],'icon'=>$image,'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'area'=>".$area.",'lat'=>$queRow['lat'],'long'=>$queRow['long1'],'rating'=>$rating);
  369. $contents['result'] = 'successfull';
  370. $contents['details'] = $arr1;
  371. }
  372. }
  373. else
  374. {
  375. $contents['result'] = 'no food found';
  376. }
  377. header("content-type: application/json");
  378. echo json_encode($contents);
  379. }
  380. function GetHospital(){
  381. $obj=new funcs_code();
  382. $obj->connection();
  383. $category = $_REQUEST['category'];
  384. $area = $_REQUEST['area'];
  385. $long = $_REQUEST['long'];
  386. $lat = $_REQUEST['lat'];
  387. $sele_res = mysql_query("SELECT * FROM `hospital` where `speciality`='$category' AND `area`='$area' ORDER BY `id` DESC");
  388. $contents = array();
  389. //$image='http://base3.engineerbabu.com/city_app/image/hospital.png';
  390. if(mysql_num_rows($sele_res)>0)
  391. {
  392. while($queRow = mysql_fetch_assoc($sele_res))
  393. {
  394. $id = $queRow['id'];
  395. $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
  396. $r = mysql_query($ave);
  397. $res = mysql_fetch_array($r);
  398. $rating=$res['avgrate'];
  399. if($rating == null)
  400. {
  401. $rating = 0;
  402. }
  403. $sel= "select * from speciality where id = '".$queRow['speciality']."'";
  404. $r = mysql_query($sel);
  405. $res=mysql_fetch_array($r);
  406. $cate = $res['name'];
  407. $sel1= "select * from area where id = '".$queRow['area']."'";
  408. $r1 = mysql_query($sel1);
  409. $res1=mysql_fetch_array($r1);
  410. $area = $res1['name'];
  411. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  412. $dis=round($dis_cal,2);
  413. $arr1[]= array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'description'=>$queRow['description'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'area'=>".$area.",'lat'=>$queRow['lat'],'long'=>$queRow['long1'],'rating'=>$rating);
  414. $contents['result'] = 'successfull';
  415. $contents['details'] = $arr1;
  416. }
  417. }
  418. else
  419. {
  420. $contents['result'] = 'no Hospital found';
  421. }
  422. header("content-type: application/json");
  423. echo json_encode($contents);
  424. }
  425. function GetBank(){
  426. $obj=new funcs_code();
  427. $obj->connection();
  428. $category = $_REQUEST['category'];
  429. $area = $_REQUEST['area'];
  430. $long = $_REQUEST['long'];
  431. $lat = $_REQUEST['lat'];
  432. $sele_res = mysql_query("SELECT * FROM `bank` where `speciality`= '$category' AND `area`= '$area' ORDER BY `id` DESC");
  433. $contents = array();
  434. if(mysql_num_rows($sele_res)>0)
  435. {
  436. while($queRow = mysql_fetch_assoc($sele_res))
  437. {
  438. //$base_url = "http://base3.engineerbabu.com/city_app_admin/";
  439. //$image = $base_url.$queRow['icon'];
  440. $sel= "select * from speciality where id = '".$queRow['speciality']."'";
  441. $r = mysql_query($sel);
  442. $res=mysql_fetch_array($r);
  443. $cate = $res['name'];
  444. $sel1= "select * from area where id = '".$queRow['area']."'";
  445. $r1 = mysql_query($sel1);
  446. $res1=mysql_fetch_array($r1);
  447. $area = $res1['name'];
  448. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  449. $dis=round($dis_cal,2);
  450. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'area'=>".$area.",'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
  451. $contents['result'] = 'successfull';
  452. $contents['details'] = $arr1;
  453. }
  454. }
  455. else
  456. {
  457. $contents['result'] = 'no Bank found';
  458. }
  459. header("content-type: application/json");
  460. echo json_encode($contents);
  461. }
  462. function GetHostel(){
  463. $obj=new funcs_code();
  464. $obj->connection();
  465. $category = 47;
  466. $area = $_REQUEST['area'];
  467. $long = $_REQUEST['long'];
  468. $lat = $_REQUEST['lat'];
  469. $sele_res = mysql_query("SELECT * FROM `hostel` where `area`='$area' ORDER BY `id` DESC");
  470. $contents = array();
  471. // $image='http://javaspeaking.com/city_app/image/';
  472. if(mysql_num_rows($sele_res)>0)
  473. {
  474. while($queRow = mysql_fetch_assoc($sele_res))
  475. {
  476. $id = $queRow['id'];
  477. $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
  478. $r = mysql_query($ave);
  479. $res = mysql_fetch_array($r);
  480. $rating=$res['avgrate'];
  481. if($rating == null)
  482. {
  483. $rating = 0;
  484. }
  485. $sel1= "select * from area where id = '".$queRow['area']."'";
  486. $r1 = mysql_query($sel1);
  487. $res1=mysql_fetch_array($r1);
  488. $area = $res1['name'];
  489. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  490. $dis=round($dis_cal,2);
  491. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'area'=>".$area.",'lat'=>$queRow['lat'],'long'=>$queRow['long1'],'rating'=>$rating);
  492. $contents['result'] = 'successfull';
  493. $contents['details'] = $arr1;
  494. }
  495. }
  496. else
  497. {
  498. $contents['result'] = 'no hostel found';
  499. }
  500. header("content-type: application/json");
  501. echo json_encode($contents);
  502. }
  503. function GetProperty()
  504. {
  505. $obj=new funcs_code();
  506. $obj->connection();
  507. $category = $_REQUEST['category'];
  508. $area = $_REQUEST['area'];
  509. $long = $_REQUEST['long'];
  510. $lat = $_REQUEST['lat'];
  511. $sele_res = mysql_query("SELECT * FROM `property` where `speciality`='$category' AND `area`='$area' ORDER BY `property_id` DESC");
  512. $contents = array();
  513. //$image='http://javaspeaking.com/city_app/city_app_admin/';
  514. if(mysql_num_rows($sele_res)>0)
  515. {
  516. while($queRow = mysql_fetch_assoc($sele_res))
  517. {
  518. $image = $queRow['icon'];
  519. //$base_url='http://javaspeaking.com/city_app/city_app_admin/';
  520. //$image1 = base_url.$image;
  521. $image1 = base_url.$image;
  522. $id = $queRow['property_id'];
  523. $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
  524. $r = mysql_query($ave);
  525. $res = mysql_fetch_array($r);
  526. $rating=$res['avgrate'];
  527. if($rating == null)
  528. {
  529. $rating = 0;
  530. }
  531. $sel= "select * from speciality where id = '".$queRow['speciality']."'";
  532. $r = mysql_query($sel);
  533. $res=mysql_fetch_array($r);
  534. $cate = $res['name'];
  535. $sel1= "select * from area where id = '".$queRow['area']."'";
  536. $r1 = mysql_query($sel1);
  537. $res1=mysql_fetch_array($r1);
  538. $area = $res1['name'];
  539. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  540. $dis=round($dis_cal,2);
  541. $arr1[]=array('distance'=>$dis,'id'=>$queRow['property_id'],'icon'=>$image1,'name'=>$queRow['address'],'address'=>$queRow['description'],'mobile'=>$queRow['mobile'],'area'=>".$area.",'lat'=>$queRow['lat'],'long'=>$queRow['long1'],'rating'=>$rating);
  542. $contents['result'] = 'successfull';
  543. $contents['details'] = $arr1;
  544. }
  545. }
  546. else
  547. {
  548. $contents['result'] = 'no Property found';
  549. }
  550. header("content-type: application/json");
  551. echo json_encode($contents);
  552. }
  553. function GetFitness()
  554. {
  555. $obj=new funcs_code();
  556. $obj->connection();
  557. $category = $_REQUEST['category'];
  558. $area = $_REQUEST['area'];
  559. $long = $_REQUEST['long'];
  560. $lat = $_REQUEST['lat'];
  561. $sele_res = mysql_query("SELECT * FROM `gym` where `speciality`='$category' AND `area`='$area' ORDER BY `id` DESC");
  562. $contents = array();
  563. //$image='http://base3.engineerbabu.com/city_app/image/';
  564. if(mysql_num_rows($sele_res)>0)
  565. {
  566. while($queRow = mysql_fetch_assoc($sele_res))
  567. {
  568. //base_url = "http://base3.engineerbabu.com/city_app_admin/";
  569. //$image = $base_url.$queRow['icon'];
  570. $id = $queRow['id'];
  571. $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
  572. $r = mysql_query($ave);
  573. $res = mysql_fetch_array($r);
  574. $rating=$res['avgrate'];
  575. if($rating == null)
  576. {
  577. $rating = 0;
  578. }
  579. $sel= "select * from speciality where id = '".$queRow['speciality']."'";
  580. $r = mysql_query($sel);
  581. $res=mysql_fetch_array($r);
  582. $cate = $res['name'];
  583. $sel1= "select * from area where id = '".$queRow['area']."'";
  584. $r1 = mysql_query($sel1);
  585. $res1=mysql_fetch_array($r1);
  586. $area = $res1['name'];
  587. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  588. $dis=round($dis_cal,2);
  589. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'area'=>".$area.",'lat'=>$queRow['lat'],'long'=>$queRow['long1'],'rating'=>$rating);
  590. $contents['result'] = 'successfull';
  591. $contents['details'] = $arr1;
  592. }
  593. }
  594. else
  595. {
  596. $contents['result'] = 'no Activity found';
  597. }
  598. header("content-type: application/json");
  599. echo json_encode($contents);
  600. }
  601. function GetTransport()
  602. {
  603. $obj=new funcs_code();
  604. $obj->connection();
  605. $category = $_REQUEST['category'];
  606. $area = $_REQUEST['area'];
  607. $long = $_REQUEST['long'];
  608. $lat = $_REQUEST['lat'];
  609. $contents['result'] = 'No Data Found';
  610. if ($category == 28)
  611. {
  612. $sele_res = mysql_query("SELECT * FROM `ibus` ORDER BY `id` DESC");
  613. }elseif ($category == 29)
  614. {
  615. $sele_res = mysql_query("SELECT * FROM `bus_station` ORDER BY `id` DESC");
  616. }elseif ($category == 30)
  617. {
  618. $sele_res = mysql_query("SELECT * FROM `car_rental` ORDER BY `id` DESC");
  619. }elseif ($category == 31)
  620. {
  621. $sele_res = mysql_query("SELECT * FROM `train_station` ORDER BY `id` DESC");
  622. }elseif ($category == 32)
  623. {
  624. $sele_res = mysql_query("SELECT * FROM `airport` ORDER BY `id` DESC");
  625. }
  626. if($area == 1)
  627. {
  628. $min = 0;
  629. $max = 1;
  630. }elseif ($area == 2)
  631. {
  632. $min = 1;
  633. $max = 2;
  634. }elseif ($area == 3)
  635. {
  636. $min = 2;
  637. $max = 5;
  638. }
  639. //$image='http://base3.engineerbabu.com/city_app/image/';
  640. if(mysql_num_rows($sele_res)>0)
  641. {
  642. while($queRow = mysql_fetch_assoc($sele_res))
  643. {
  644. $id = $queRow['id'];
  645. $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
  646. $r = mysql_query($ave);
  647. $res = mysql_fetch_array($r);
  648. $rating=$res['avgrate'];
  649. if($rating == null)
  650. {
  651. $rating = 0;
  652. }
  653. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  654. $dis=round($dis_cal,2);
  655. if($dis >=$min && $dis <= $max)
  656. {
  657. $contents['result'] = 'successfull';
  658. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1'],'rating'=>$rating);
  659. }
  660. }
  661. }
  662. if($arr1==null)
  663. {
  664. $arr1= array();
  665. }
  666. $contents['details'] = $arr1;
  667. header("content-type: application/json");
  668. echo json_encode($contents);
  669. }
  670. function GetEducation()
  671. {
  672. $obj=new funcs_code();
  673. $obj->connection();
  674. $category = $_REQUEST['category'];
  675. $area = $_REQUEST['area'];
  676. $long = $_REQUEST['long'];
  677. $lat = $_REQUEST['lat'];
  678. $contents['result'] = 'No Data Found';
  679. if ($category == 33)
  680. {
  681. $sele_res = mysql_query("SELECT * FROM `school` ORDER BY `id` DESC");
  682. }elseif ($category == 34)
  683. {
  684. $sele_res = mysql_query("SELECT * FROM `college` ORDER BY `id` DESC");
  685. }elseif ($category == 35)
  686. {
  687. $sele_res = mysql_query("SELECT * FROM `coaching_center` ORDER BY `id` DESC");
  688. }
  689. if($area == 1)
  690. {
  691. $min = 1;
  692. $max = 2;
  693. }elseif ($area == 2)
  694. {
  695. $min = 2;
  696. $max = 5;
  697. }elseif ($area == 3)
  698. {
  699. $min = 5;
  700. $max = 5000;
  701. }
  702. $contents = array();
  703. //$image='http://base3.engineerbabu.com/city_app/image/';
  704. if(mysql_num_rows($sele_res)>0)
  705. {
  706. while($queRow = mysql_fetch_assoc($sele_res))
  707. {
  708. $id = $queRow['id'];
  709. $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
  710. $r = mysql_query($ave);
  711. $res = mysql_fetch_array($r);
  712. $rating=$res['avgrate'];
  713. if($rating == null)
  714. {
  715. $rating = 0;
  716. }
  717. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  718. $dis=round($dis_cal,2);
  719. if($dis >=$min && $dis <= $max)
  720. {
  721. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1'],'rating'=>$rating);
  722. $contents['result'] = 'successfull';
  723. $contents['details'] = $arr1;
  724. }
  725. }
  726. }
  727. if($arr1==null)
  728. {
  729. $arr1= array();
  730. $contents['result'] = 'No Data Found';
  731. }
  732. $contents['details'] = $arr1;
  733. header("content-type: application/json");
  734. echo json_encode($contents);
  735. }
  736. function GetAtm()
  737. {
  738. $obj=new funcs_code();
  739. $obj->connection();
  740. //$category = $_REQUEST['category'];
  741. $area = $_REQUEST['area'];
  742. $long = $_REQUEST['long'];
  743. $lat = $_REQUEST['lat'];
  744. $contents['result'] = 'No Data Found';
  745. $sele_res = mysql_query("SELECT * FROM `atm` ORDER BY `id` DESC");
  746. if($area == 1)
  747. {
  748. $min = 0;
  749. $max = 1;
  750. }elseif ($area == 2)
  751. {
  752. $min = 1;
  753. $max = 2;
  754. }
  755. $contents = array();
  756. //$image='http://base3.engineerbabu.com/city_app/image/';
  757. if(mysql_num_rows($sele_res)>0)
  758. {
  759. while($queRow = mysql_fetch_assoc($sele_res))
  760. {
  761. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  762. $dis=round($dis_cal,2);
  763. if($dis >=$min && $dis <= $max)
  764. {
  765. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
  766. $contents['result'] = 'successfull';
  767. $contents['details'] = $arr1;
  768. }
  769. }
  770. }
  771. if($arr1==null)
  772. {
  773. $arr1= array();
  774. }
  775. $contents['details'] = $arr1;
  776. header("content-type: application/json");
  777. echo json_encode($contents);
  778. }
  779. function GetPetrolpump()
  780. {
  781. $obj=new funcs_code();
  782. $obj->connection();
  783. //$category = $_REQUEST['category'];
  784. $area = $_REQUEST['area'];
  785. $long = $_REQUEST['long'];
  786. $lat = $_REQUEST['lat'];
  787. $contents['result'] = 'No Data Found';
  788. $sele_res = mysql_query("SELECT * FROM `petrol_pump` ORDER BY `id` DESC");
  789. if($area == 1)
  790. {
  791. $min = 0;
  792. $max = 1;
  793. }elseif ($area == 2)
  794. {
  795. $min = 1;
  796. $max = 2;
  797. }
  798. $contents = array();
  799. //$image='http://base3.engineerbabu.com/city_app/image/';
  800. if(mysql_num_rows($sele_res)>0)
  801. {
  802. while($queRow = mysql_fetch_assoc($sele_res))
  803. {
  804. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  805. $dis=round($dis_cal,2);
  806. if($dis >=$min && $dis <= $max)
  807. {
  808. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
  809. $contents['result'] = 'successfull';
  810. $contents['details'] = $arr1;
  811. }
  812. }
  813. }
  814. if($arr1==null)
  815. {
  816. $arr1= array();
  817. $contents['result'] = 'No Data Found';
  818. }
  819. $contents['details'] = $arr1;
  820. header("content-type: application/json");
  821. echo json_encode($contents);
  822. }
  823. function GetPlaces()
  824. {
  825. $obj=new funcs_code();
  826. $obj->connection();
  827. $category = $_REQUEST['category'];
  828. $area = $_REQUEST['area'];
  829. $long = $_REQUEST['long'];
  830. $lat = $_REQUEST['lat'];
  831. $contents['result'] = 'No Data Found';
  832. if($area == 1)
  833. {
  834. $min = 0;
  835. $max = 1;
  836. }elseif ($area == 2)
  837. {
  838. $min = 1;
  839. $max = 5000;
  840. }
  841. if ($category == 36)
  842. {
  843. $sele_res = mysql_query("SELECT * FROM `mall` ORDER BY `id` DESC");
  844. }elseif ($category == 37)
  845. {
  846. $sele_res = mysql_query("SELECT * FROM `movie_theater` ORDER BY `id` DESC");
  847. }elseif ($category == 38)
  848. {
  849. $sele = mysql_query("SELECT * from `church`");
  850. while($queRow = mysql_fetch_array($sele))
  851. {
  852. $arr[]=array('id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
  853. }
  854. $sele = mysql_query("SELECT * from `hindu_temple`");
  855. while($queRow = mysql_fetch_array($sele))
  856. {
  857. $arr[]=array('id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
  858. }
  859. $sele = mysql_query("SELECT * from `musque`");
  860. while($queRow = mysql_fetch_array($sele))
  861. {
  862. $arr[]=array('id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
  863. }
  864. }elseif ($category == 39)
  865. {
  866. $sele_res = mysql_query("SELECT * FROM `picnic_spot` ORDER BY `id` DESC");
  867. }elseif ($category == 40)
  868. {
  869. $sele_res = mysql_query("SELECT * FROM `water_park` ORDER BY `id` DESC");
  870. }elseif ($category == 41)
  871. {
  872. $sele_res = mysql_query("SELECT * FROM `zoo` ORDER BY `id` DESC");
  873. }
  874. foreach ($arr as $value )
  875. {
  876. //print_r($value); exit;
  877. $lat1 = $value['lat'];
  878. $long1 = $value['long'];
  879. $dis_cal = distance($lat,$long, $value['lat'], $value['long'], "k");
  880. $dis=round($dis_cal,2);
  881. if($dis >=$min && $dis <= $max)
  882. {
  883. $arr2[]=array('distance'=>$dis,'id'=>$value['id'],'name'=>$value['name'],'icon'=>$value['icon'],'address'=>$value['address'],'mobile'=>$value['mobile'],'lat'=>$value['lat'],'long'=>$value['long']);
  884. }
  885. }
  886. //$image='http://base3.engineerbabu.com/city_app/image/';
  887. if(mysql_num_rows($sele_res)>0)
  888. {
  889. while($queRow = mysql_fetch_assoc($sele_res))
  890. {
  891. $id = $queRow['id'];
  892. $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
  893. $r = mysql_query($ave);
  894. $res = mysql_fetch_array($r);
  895. $rating=$res['avgrate'];
  896. if($rating == null)
  897. {
  898. $rating = 0;
  899. }
  900. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  901. $dis=round($dis_cal,2);
  902. if($dis >=$min && $dis <= $max)
  903. {
  904. $contents['result'] = 'successfull';
  905. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1'],'rating'=>$rating);
  906. }
  907. }
  908. }
  909. if($arr1==null )
  910. {
  911. $arr1= array();
  912. }else{
  913. $contents['result'] = 'successfull';
  914. $contents['details'] = $arr1;
  915. }
  916. if($arr2 == null)
  917. {
  918. $arr2= array();
  919. }else{
  920. $contents['result'] = 'successfull';
  921. $contents['details'] = $arr2;
  922. }
  923. header("content-type: application/json");
  924. echo json_encode($contents);
  925. }
  926. function GetJob()
  927. {
  928. $obj=new funcs_code();
  929. $obj->connection();
  930. $category = $_REQUEST['category'];
  931. $area = $_REQUEST['area'];
  932. $experience = $_REQUEST['experience'];
  933. //$long = $_REQUEST['long'];
  934. //$lat = $_REQUEST['lat'];
  935. /*if($area == 1)
  936. {
  937. $experience = "Fresher";
  938. }else
  939. {
  940. $experience = "Experience";
  941. }*/
  942. $contents['result'] = 'No Data Found';
  943. $sele_res = mysql_query("SELECT * FROM `job_post` where speciality = '$category' AND area = '$area' ORDER BY `id` DESC");
  944. if(mysql_num_rows($sele_res)>0)
  945. {
  946. while($queRow = mysql_fetch_assoc($sele_res))
  947. {
  948. // $base_url = "http://base3.engineerbabu.com/city_app_admin/";
  949. $image = base_url.$queRow['icon'];
  950. $contents['result'] = 'successfull';
  951. $arr1[]=array('id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$image,'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'experience'=>$experience);
  952. }
  953. }
  954. if($arr1==null)
  955. {
  956. $arr1= array();
  957. $contents['result'] = 'No Data Found';
  958. }
  959. $contents['details'] = $arr1;
  960. header("content-type: application/json");
  961. echo json_encode($contents);
  962. }
  963. function GetPolice(){
  964. $obj=new funcs_code();
  965. $obj->connection();
  966. $long = $_REQUEST['long'];
  967. $lat = $_REQUEST['lat'];
  968. $sele_res = mysql_query("SELECT * FROM `police` ORDER BY `id` DESC");
  969. $contents = array();
  970. //$image='http://base3.engineerbabu.com/city_app/image/hospital.png';
  971. if(mysql_num_rows($sele_res)>0)
  972. {
  973. while($queRow = mysql_fetch_assoc($sele_res))
  974. {
  975. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  976. $dis=round($dis_cal,2);
  977. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
  978. $contents['result'] = 'successfull';
  979. $contents['details'] = $arr1;
  980. }
  981. }
  982. else
  983. {
  984. $contents['result'] = 'no data found';
  985. }
  986. header("content-type: application/json");
  987. echo json_encode($contents);
  988. }
  989. function UserProfileUpdate()
  990. {
  991. $obj=new funcs_code();
  992. $obj->connection();
  993. $output = "";
  994. $userid= ($_REQUEST['userid']);
  995. $username= $_REQUEST['username'];
  996. $mobile= $_REQUEST['mobile'];
  997. $companyname= $_REQUEST['companyname'];
  998. $file=$_FILES['file']['tmp_name'];
  999. $image= $_FILES['file']['tmp_name'];
  1000. $image_name= $_FILES['file']['name'];
  1001. $image=$_FILES["file"]["name"];
  1002. $time=date('d-m-y i:m:s');
  1003. $image=$time.$image;
  1004. move_uploaded_file($_FILES["file"]["tmp_name"],"images/".$image);
  1005. $location="images/".$image;
  1006. if($_FILES['file']['tmp_name']=='' && $_FILES['file']['tmp_name']==null)
  1007. {
  1008. $update_user = mysql_query("UPDATE `user` SET `username`= '$username',`mobile`='$mobile',`company_name`='$companyname' WHERE `id`='$userid'");
  1009. }else
  1010. {
  1011. $update_user = mysql_query("UPDATE `user` SET `username`= '$username',`mobile`='$mobile',`company_name`='$companyname',`image`= '$location' WHERE `id`='$userid'");
  1012. }
  1013. $sql = "SELECT * FROM `user` WHERE `id`='$userid'";
  1014. $res = mysql_query($sql);
  1015. $queRow= mysql_fetch_array($res);
  1016. $id=$queRow['id'];
  1017. $image1 = $queRow['image'];
  1018. //$base_url="http://javaspeaking.com/city_app/city_app_admin/";
  1019. $image = base_url.$image1;
  1020. $arr1[]=array('user_id'=>$queRow['id'],'username'=>$queRow['username'],'email'=>$queRow['email'],'mobile_no'=>$queRow['mobile'],'company_name'=>$queRow['company_name'],'icon'=>$image);
  1021. if($arr1 == '')
  1022. {
  1023. $arr1 = array();
  1024. }else
  1025. {
  1026. $contents['result'] = 'successfull';
  1027. $contents['info'] = $arr1;
  1028. }
  1029. header("content-type: application/json");
  1030. echo json_encode($contents);
  1031. }
  1032. function Homedelivery()
  1033. {
  1034. $obj=new funcs_code();
  1035. $obj->connection();
  1036. //$category = $_REQUEST['category'];
  1037. $area = $_REQUEST['area'];
  1038. $long = $_REQUEST['long'];
  1039. $lat = $_REQUEST['lat'];
  1040. $contents['result'] = 'No Data Found';
  1041. $sele_res = mysql_query("SELECT * FROM `home_delivery` ORDER BY `id` DESC");
  1042. if($area == 1)
  1043. {
  1044. $min = 0;
  1045. $max = 1;
  1046. }elseif ($area == 2)
  1047. {
  1048. $min = 1;
  1049. $max = 10000;
  1050. }
  1051. $contents = array();
  1052. //$image='http://base3.engineerbabu.com/city_app/image/';
  1053. if(mysql_num_rows($sele_res)>0)
  1054. {
  1055. while($queRow = mysql_fetch_assoc($sele_res))
  1056. {
  1057. //$base_url = "http://javaspeaking.com/city_app/city_app_admin/images/";
  1058. //$image = $base_url.$queRow['icon'];
  1059. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  1060. $dis=round($dis_cal,2);
  1061. if($dis >=$min && $dis <= $max)
  1062. {
  1063. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
  1064. $contents['result'] = 'successfull';
  1065. $contents['details'] = $arr1;
  1066. }
  1067. }
  1068. }
  1069. if($arr1==null)
  1070. {
  1071. $arr1= array();
  1072. $contents['result'] = 'No Data Found';
  1073. }
  1074. $contents['details'] = $arr1;
  1075. header("content-type: application/json");
  1076. echo json_encode($contents);
  1077. }
  1078. function Popularinindore()
  1079. {
  1080. $obj=new funcs_code();
  1081. $obj->connection();
  1082. //$category = $_REQUEST['category'];
  1083. $long = $_REQUEST['long'];
  1084. $lat = $_REQUEST['lat'];
  1085. $contents['result'] = 'No Data Found';
  1086. $sele_res = mysql_query("SELECT * FROM `top_place` ORDER BY `id` DESC");
  1087. $contents = array();
  1088. //$image='http://base3.engineerbabu.com/city_app/image/';
  1089. if(mysql_num_rows($sele_res)>0)
  1090. {
  1091. while($queRow = mysql_fetch_assoc($sele_res))
  1092. {
  1093. $placeid = $queRow['id'];
  1094. $imgsel= mysql_query("SELECT * FROM `top_place_image` where top_place_id = '$placeid'");
  1095. if(mysql_num_rows($imgsel)>0)
  1096. {
  1097. $resimg=mysql_fetch_array($imgsel);
  1098. //$base_url = "http://base3.engineerbabu.com/city_app_admin/";
  1099. $img = $resimg['image'];
  1100. $image = base_url.$img;
  1101. }else
  1102. {
  1103. $image = '';
  1104. }
  1105. $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
  1106. $dis=round($dis_cal,2);
  1107. if($queRow['lat'] == "" || $queRow['long1'] == "")
  1108. {
  1109. $dis = 0;
  1110. }
  1111. $arr1[]=array('distance'=>$dis,'id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$image,'address'=>$queRow['address'],'description'=>$queRow['description'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
  1112. }
  1113. }
  1114. if($arr1==null)
  1115. {
  1116. $arr1= array();
  1117. $contents['result'] = 'No Data Found';
  1118. }else
  1119. {
  1120. $contents['result'] = 'successfull';
  1121. $contents['details'] = $arr1;
  1122. }
  1123. header("content-type: application/json");
  1124. echo json_encode($contents);
  1125. }
  1126. function AddRating()
  1127. {
  1128. $obj=new funcs_code();
  1129. $obj->connection();
  1130. //$category = $_REQUEST['category'];
  1131. $userid = $_REQUEST['userid'];
  1132. $categoryid = $_REQUEST['categoryid'];
  1133. $subcateid = $_REQUEST['subcateid'];
  1134. $rating = $_REQUEST['rating'];
  1135. $time = round(microtime(true) * 1000);
  1136. //$contents['result'] = 'No Data Found';
  1137. //"SELECT * FROM `rating_table` where user_id = '$userid' AND category_id = '$categoryid'";
  1138. $sele_res = mysql_query("SELECT * FROM `rating_table` where (user_id = '$userid' AND category_id = '$categoryid' AND subcate_id = '$subcateid')");
  1139. if(mysql_num_rows($sele_res)>0)
  1140. {
  1141. $contents['result']="Already Exist";
  1142. }else
  1143. {
  1144. $ins_user=mysql_query("INSERT INTO `rating_table` (`user_id`,`category_id`,`rating`,`subcate_id`,`created_at`) VALUES('$userid','$categoryid','$rating','$subcateid','$time')");
  1145. if($ins_user)
  1146. {
  1147. $contents['result'] = 'successfull';
  1148. }
  1149. }
  1150. $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$categoryid' AND subcate_id = '$subcateid'";
  1151. $r = mysql_query($ave);
  1152. while($res = mysql_fetch_array($r))
  1153. {
  1154. $avgrate = $res['avgrate'];
  1155. $arr[]= array('rating'=>$res['avgrate']);
  1156. }
  1157. $contents['info'] = $arr;
  1158. header("content-type: application/json");
  1159. echo json_encode($contents);
  1160. }
  1161. function NotificationOnOff()
  1162. {
  1163. $obj=new funcs_code();
  1164. $obj->connection();
  1165. $output = "";
  1166. //$contents['success'] = 'false';
  1167. $userid = $_REQUEST['userid'];
  1168. $status = $_REQUEST['status'];
  1169. $food= $_REQUEST['food'];
  1170. $place = $_REQUEST['place'];
  1171. $job= $_REQUEST['job'];
  1172. $hospital= $_REQUEST['hospital'];
  1173. $hostel = $_REQUEST['hostel'];
  1174. $bank = $_REQUEST['bank'];
  1175. $atm = $_REQUEST['atm'];
  1176. $education = $_REQUEST['education'];
  1177. $transport = $_REQUEST['transport'];
  1178. $police = $_REQUEST['police'];
  1179. $petrolpump = $_REQUEST['petrolpump'];
  1180. $property = $_REQUEST['property'];
  1181. $fittness = $_REQUEST['fittness'];
  1182. $homedelivery = $_REQUEST['homedelivery'];
  1183. $popular = $_REQUEST['popular'];
  1184. $gallary = $_REQUEST['gallary'];
  1185. $notif = mysql_query("SELECT * FROM `notification_status` WHERE `user_id`='$userid'");
  1186. if(mysql_num_rows($notif)>0)
  1187. {
  1188. while($res=mysql_fetch_array($notif)){
  1189. $id=$res['user_id'];
  1190. if($id == $userid)
  1191. {
  1192. $notif_update = mysql_query("UPDATE `notification_status` SET `restaurant_dhaba_tiffin`='$food',`mall`='$place',`movie_theater`='$place',`church`='$place',`hindu_temple`='$place',`musque`='$place',`picnic_spot`='$place',`water_park`='$place',`zoo`='$place',`job_post`='$job',`hospital`='$hospital',`hostel`='$hostel',`bank`='$bank',`atm`='$atm',`school`='$education',`college`='$education',`coaching_center`='$education',`ibus`='$transport',`bus_station`='$transport',`car_rental`='$transport',`train_station`='$transport',`airport`='$transport',`police`='$police',`petrol_pump`='$petrolpump',`property`='$property',`gym`='$fittness',`home_delivery`='$homedelivery',`Popularinindore`='$popular',`gallary`='$gallary' WHERE `user_id`='$userid'");
  1193. }
  1194. }
  1195. if($notif_update)
  1196. {
  1197. $contents['result'] = 'successfull';
  1198. }
  1199. else{
  1200. $contents['result'] = 'Failed';
  1201. }
  1202. }else
  1203. {
  1204. $ins_user=mysql_query("INSERT INTO `notification_status` (`user_id`,`restaurant_dhaba_tiffin`,`mall`,`movie_theater`,`church`,`hindu_temple`,`musque`,`picnic_spot`,`water_park`,`zoo`,`job_post`,`hospital`,`hostel`,`bank`,`atm`,`school`,`college`,`coaching_center`,`ibus`,`bus_station`,`car_rental`,`train_station`,`airport`,`police`,`petrol_pump`,`property`,`gym`,`home_delivery`,`Popularinindore`,`gallary`) VALUES('$userid','$food','$place','$place','$place','$place','$place','$place','$place','$place','$job','$hospital','$hostel','$bank','$atm','$education','$education','$education','$transport','$transport','$transport','$transport','$transport','$police','$petrolpump','$property','$fittness','$homedelivery','$popular','$gallary')");
  1205. if($ins_user)
  1206. {
  1207. $contents['result'] = 'insert successfull';
  1208. }else
  1209. {
  1210. $contents['result'] = 'insert failed';
  1211. }
  1212. }
  1213. header("content-type: application/json");
  1214. echo json_encode($contents);
  1215. }
  1216. function Gallary(){
  1217. $obj=new funcs_code();
  1218. $obj->connection();
  1219. $sele_res = mysql_query("SELECT * FROM `Gallary` ORDER BY `id` DESC");
  1220. $contents = array();
  1221. //$image='http://base3.engineerbabu.com/city_app/image/hospital.png';
  1222. if(mysql_num_rows($sele_res)>0)
  1223. {
  1224. while($queRow = mysql_fetch_assoc($sele_res))
  1225. {
  1226. $image = $queRow['image'];
  1227. //$base_url = "http://javaspeaking.com/city_app/city_app_admin/";
  1228. $image1 = base_url.$image;
  1229. $arr1[]=array('id'=>$queRow['id'],'name'=>$queRow['Name'],'icon'=>$image1);
  1230. }
  1231. if($arr1 == null)
  1232. {
  1233. $contents = array();
  1234. }else
  1235. {
  1236. $contents['result'] = 'successfull';
  1237. $contents['details'] = $arr1;
  1238. }
  1239. }
  1240. else
  1241. {
  1242. $contents['result'] = 'no data found';
  1243. }
  1244. header("content-type: application/json");
  1245. echo json_encode($contents);
  1246. }
  1247. function GetEvent(){
  1248. $obj=new funcs_code();
  1249. $obj->connection();
  1250. $category = $_REQUEST['category'];
  1251. $area = $_REQUEST['area'];
  1252. $contents['result'] = 'failed';
  1253. if($area == 1)
  1254. {
  1255. // echo ("dfdfd");
  1256. // "SELECT * FROM event WHERE date >= DATE_SUB(NOW(), INTERVAL 1 DAY) AND speciality = '$category'";
  1257. $sele_res = mysql_query("…

Large files files are truncated, but you can click here to view the full file