/cityapp.php
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
- <?php
- error_reporting(0);
- $base_url = 'http://base3.engineerbabu.com:8282/city_app_indore/';
- define("base_url", $base_url);
-
- Init();
- class funcs_code
- {
- var $conn="";
- var $dba="city_app";
- var $host="localhost";
- var $user="root";
- var $pass="Engi@@rBabu";
- public function connection()
- {
- $this->conn = mysql_connect($this->host,$this->user,$this->pass) or die(mysql_error());
- $this->dba = mysql_select_db($this->dba,$this->conn) or die(mysql_error());
- }
-
- }
- function Init()
- {
- $method = $_GET['method'];
- if($method== "SignIn"){
- SignIn();
- }elseif($method=="SignUp"){
-
- SignUp();
-
- }elseif($method=="SocialSignIn"){
-
- SocialSignIn();
-
- }elseif($method=="ForgotPassword"){
-
- ForgotPassword();
-
- }elseif($method=="ChangePassword"){
-
- ChangePassword();
-
- }elseif($method=="GetRestaurantDhabaTiffin"){
-
- GetRestaurantDhabaTiffin();
-
- }elseif($method=="GetBank"){
-
-
- GetBank();
-
- }elseif($method=="GetFitness"){
-
- GetFitness();
-
- }elseif($method=="GetHospital"){
-
- GetHospital();
-
- }elseif($method=="GetHostel"){
-
- GetHostel();
-
- }elseif($method=="GetProperty"){
-
- GetProperty();
- }elseif($method=="GetTransport"){
-
- GetTransport();
- }elseif($method=="GetEducation"){
-
- GetEducation();
-
- }elseif($method=="GetAtm"){
-
- GetAtm();
-
- }elseif($method=="GetPetrolpump"){
-
- GetPetrolpump();
-
- }elseif($method=="GetPlaces"){
-
- GetPlaces();
-
- }elseif($method=="GetJob"){
-
- GetJob();
-
- }elseif($method=="GetPolice"){
-
- GetPolice();
-
- }elseif($method=="UserProfileUpdate"){
-
- UserProfileUpdate();
- }elseif($method=="Homedelivery"){
-
- Homedelivery();
-
- }elseif($method=="Popularinindore"){
-
- Popularinindore();
- }elseif($method=="AddRating"){
-
- AddRating();
- }elseif($method=="NotificationOnOff"){
-
- NotificationOnOff();
- }elseif($method=="Gallary"){
-
- Gallary();
- }elseif($method=="GetEvent"){
-
- GetEvent();
- }elseif($method=="GetAllDataBySearch"){
-
- GetAllDataBySearch();
- }elseif($method=="GetAllData"){
-
- GetAllData();
- }elseif($method=="Trending"){
-
- Trending();
-
- }elseif($method=="Banner"){
-
- Banner();
-
- }elseif($method=="hitcounter"){
-
- hitcounter();
- }elseif($method=="AppVersion"){
-
- AppVersion();
-
- }
- }
- function SignIn()
- {
- $obj=new funcs_code();
- $obj->connection();
- $email= $_REQUEST['email'];
- $password = md5($_REQUEST['password']);
- $device_token = $_REQUEST['device_token'];
-
- $sql = "SELECT * FROM `user` WHERE `email`= '$email' AND `password`= '$password'";
- $res = mysql_query($sql);
-
- $contents['result'] = 'failed';
-
- if(mysql_num_rows($res)>0)
- {
- $queRow = mysql_fetch_assoc($res);
- $user_id=$queRow['id'];
- $image1 = $queRow['image'];
- $image = base_url.$image1;
- $sql11=mysql_query("UPDATE `user` SET `device_token`='$device_token' WHERE`id`='$user_id'");
- $arr=array('user_id'=>$queRow['id'],
- 'username'=>$queRow['username'],
- 'email'=>$queRow['email'],
- 'mobile'=>$queRow['mobile'],
- 'company_name'=>$queRow['company_name'],
- 'image'=>$image);
- $contents['result'] = 'successfull';
- $contents['info'] = $arr;
- }
- else
- {
- $contents['result'] = 'email and password not matched';
- }
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function SignUp(){
- $obj=new funcs_code();
- $obj->connection();
- $output = "";
- $username= ($_REQUEST['username']);
-
- $email = $_REQUEST['email'];
-
- $password= md5($_REQUEST['password']);
- $mobile= $_REQUEST['mobile'];
- $company_name= $_REQUEST['company_name'];
- $device_token= $_REQUEST['device_token'];
- //$device_type= $_REQUEST['device_type'];
- $contents['result'] = 'failed';
- $sql = "SELECT * FROM `user` WHERE `email` = '$email' ";
- $res = mysql_query($sql);
- if(mysql_num_rows($res)>0)
- {
- while($result = mysql_fetch_assoc($res))
- {
- if($result['email'] == $email)
- {
- $contents['result'] = 'Email Already Exist';
- }
- }
- }
- else
- {
- $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')";
- if(mysql_query($q))
- {
- $id = mysql_insert_id();
- $sql1 = "SELECT * FROM `user` WHERE `id`= '$id'";
- $res1 = mysql_query($sql1);
- while($queRow = mysql_fetch_assoc($res1))
- {
- $arr=array('user_id'=>$queRow['id'],'username'=>$queRow['username'],'email'=>$queRow['email'],'mobile'=>$queRow['mobile'],'company_name'=>$queRow['company_name']);
- $contents['result'] = 'successfull';
- $contents['info'] =$arr;
- }
-
- }
-
- }
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function SocialSignIn(){
- $obj=new funcs_code();
- $obj->connection();
-
- $contents['result'] = 'failed';
-
-
- $name= $_REQUEST['name'];
-
- $email = $_REQUEST['email'];
- $address = $_REQUEST['address'];
- $image= $_REQUEST['image'];
-
- $gender= $_REQUEST['gender'];
- $place = $_REQUEST['place'];
- $fb_id = $_REQUEST['fb_id'];
- $dob = $_REQUEST['dob'];
- $work = $_REQUEST['work'];
- $education = $_REQUEST['education'];
- $job_seeker = $_REQUEST['job_seeker'];
- $job_provider = $_REQUEST['job_provider'];
- $device_token = $_REQUEST['device_token'];
- $device_type = $_REQUEST['device_type'];
-
-
- $sql = mysql_query("SELECT * FROM `user` WHERE email = '$email'");
-
- if(mysql_num_rows($sql)>0)
- {
- $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'");
- if($q)
- {
- $sql1 = "SELECT * FROM `user` WHERE email = '$email'";
- $res1 = mysql_query($sql1);
- while($queRow = mysql_fetch_assoc($res1))
- {
- $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']);
-
- $contents['info'] =$arr;
- $sql = mysql_query("SELECT * FROM `push_notification` WHERE `email` = '$email' ");
- if(mysql_num_rows($sql)>0)
- {
- $update_token = mysql_query("UPDATE `push_notification` SET `device_token`='$device_token' WHERE `email`='$email'");
- $contents['result'] = 'successfull';
- }
- else
- {
- $insert_token = mysql_query("INSERT INTO `push_notification`(`device_token`,`email`) VALUES('$device_token','$email')");
- $contents['result'] = 'successfull';
- }
-
- }
- }
-
- }
- else
- {
-
- $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')";
-
- if(mysql_query($q))
- {
- $id = mysql_insert_id();
-
- $sql1 = "SELECT * FROM `user` WHERE `id`= '$id'";
-
- $res1 = mysql_query($sql1);
-
- while($queRow = mysql_fetch_assoc($res1))
- {
- $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']);
-
- $contents['info'] =$arr;
- $sql = mysql_query("SELECT * FROM `push_notification` WHERE `email` = '$email' ");
- if(mysql_num_rows($sql)>0)
- {
- $update_token = mysql_query("UPDATE `push_notification` SET `device_token`='$device_token' WHERE `email`='$email'");
- $contents['result'] = 'successfull';
- }
- else
- {
- $insert_token = mysql_query("INSERT INTO `push_notification`(`device_token`,`email`) VALUES('$device_token','$email')");
- $contents['result'] = 'successfull';
- }
- }
- }
- }
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function ForgotPassword()
- {
- $obj=new funcs_code();
- $obj->connection();
-
- $email = ($_REQUEST['email']);
-
- $sql = "SELECT * FROM `user` WHERE email = '$email' ";
- $res = mysql_query($sql);
-
- $contents['result'] = 'Email Not Found';
-
- if(mysql_num_rows($res)>0)
- {
- while($result = mysql_fetch_assoc($res))
- {
- $id = $result['id'];
- $password = $result['password'];
- $num = substr(randomPassword(),0,6);
- $subject = "City App: Forget Password";
- $msg = "City App New Password is $num<br/><br/>";
- $headers = 'MIME-Version: 1.0' . "\r\n";
- $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
- $headers .= 'From: No Reply <no-reply@indorecityapp.com>';
- @mail($email, $subject, $msg, $headers);
-
- $password= md5($num);
- $sql1= "UPDATE `user` SET `password`='$password' WHERE `id`='$id' ";
- $f=mysql_query($sql1);
- if($f)
- {
- $contents['result'] = 'Password sent to your email';
- }
- }
- }
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function randomPassword() {
- $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
- $pass = array(); /*remember to declare $pass as an array*/
- $alphaLength = strlen($alphabet) - 1; /*put the length -1 in cache*/
- for ($i = 0; $i < 6; $i++) {
- $n = rand(0, $alphaLength);
- $pass[] = $alphabet[$n];
- }
- return implode($pass); /*turn the array into a string*/
- }
- function ChangePassword()
- {
- $obj=new funcs_code();
- $obj->connection();
-
- $user_id= $_REQUEST['user_id'];
-
- $newpassword= md5($_REQUEST['newpassword']);
-
- $oldpassword= md5($_REQUEST['oldpassword']);
-
- $sql = "SELECT * FROM `user` WHERE `id`='$user_id' AND `password`='$oldpassword'";
- $res = mysql_query($sql);
-
- $contents['result'] = 'Old Password not match';
-
- if(mysql_num_rows($res)>0)
- {
- $sql1 = "UPDATE `user` SET `password`= '$newpassword' WHERE `id`='$user_id'";
- $res1 = mysql_query($sql1);
-
- if($res1)
- {
- $contents['result'] = 'Password Changed Successfully';
- }
- }
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function Activate()
- {
- $obj = new funcs_code();
- $obj->connection();
-
-
- $user_id= $_REQUEST['abcd123456abc'];
-
- $q1="UPDATE `user` SET `mail_verify`='1' WHERE `id`='$user_id'";
-
- $flag1=mysql_query($q1);
-
- if($flag1)
- {
- $content['result']="verified successfully";
- }
- else
- {
- $content['result']="Failed";
- }
-
- header("content-type: application/json");
- echo json_encode($content);
- }
- function distance($lat1, $lon1, $lat2, $lon2, $unit)
- {
- $theta = $lon1 - $lon2;
- $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
- $dist = acos($dist);
- $dist = rad2deg($dist);
- $miles = $dist * 60 * 1.1515;
- $unit = strtoupper($unit);
- if ($unit == "K") {
- return ($miles * 1.609344);
- } else if ($unit == "N") {
- return ($miles * 0.8684);
- } else {
- return $miles;
- }
- }
- function GetRestaurantDhabaTiffin(){
- $obj=new funcs_code();
- $obj->connection();
-
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
- $sele_res = mysql_query("SELECT * FROM `restaurant_dhaba_tiffin` where `speciality`='$category' AND `area`='$area' ORDER BY `id` DESC");
-
- $contents = array();
-
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
- $id = $queRow['id'];
- $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
- $r = mysql_query($ave);
-
- $res = mysql_fetch_array($r);
- $rating=$res['avgrate'];
- if($rating == null)
- {
- $rating = 0;
- }
- //$base_url = "http://base3.engineerbabu.com/city_app_admin/";
- $image = base_url.$queRow['icon'];
-
- $sel= "select * from speciality where id = '".$queRow['speciality']."'";
- $r = mysql_query($sel);
- $res=mysql_fetch_array($r);
- $cate = $res['name'];
-
- $sel1= "select * from area where id = '".$queRow['area']."'";
- $r1 = mysql_query($sel1);
- $res1=mysql_fetch_array($r1);
- $area = $res1['name'];
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- $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);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
-
-
- else
- {
- $contents['result'] = 'no food found';
- }
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetHospital(){
- $obj=new funcs_code();
- $obj->connection();
-
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $sele_res = mysql_query("SELECT * FROM `hospital` where `speciality`='$category' AND `area`='$area' ORDER BY `id` DESC");
-
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/hospital.png';
-
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
- $id = $queRow['id'];
- $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
- $r = mysql_query($ave);
-
- $res = mysql_fetch_array($r);
- $rating=$res['avgrate'];
- if($rating == null)
- {
- $rating = 0;
- }
-
- $sel= "select * from speciality where id = '".$queRow['speciality']."'";
- $r = mysql_query($sel);
- $res=mysql_fetch_array($r);
- $cate = $res['name'];
-
- $sel1= "select * from area where id = '".$queRow['area']."'";
- $r1 = mysql_query($sel1);
- $res1=mysql_fetch_array($r1);
- $area = $res1['name'];
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- $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);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- else
- {
- $contents['result'] = 'no Hospital found';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetBank(){
- $obj=new funcs_code();
- $obj->connection();
-
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $sele_res = mysql_query("SELECT * FROM `bank` where `speciality`= '$category' AND `area`= '$area' ORDER BY `id` DESC");
-
- $contents = array();
-
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
-
- //$base_url = "http://base3.engineerbabu.com/city_app_admin/";
- //$image = $base_url.$queRow['icon'];
-
- $sel= "select * from speciality where id = '".$queRow['speciality']."'";
- $r = mysql_query($sel);
- $res=mysql_fetch_array($r);
- $cate = $res['name'];
-
- $sel1= "select * from area where id = '".$queRow['area']."'";
- $r1 = mysql_query($sel1);
- $res1=mysql_fetch_array($r1);
- $area = $res1['name'];
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- $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']);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- else
- {
- $contents['result'] = 'no Bank found';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
-
- function GetHostel(){
- $obj=new funcs_code();
- $obj->connection();
-
- $category = 47;
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $sele_res = mysql_query("SELECT * FROM `hostel` where `area`='$area' ORDER BY `id` DESC");
-
- $contents = array();
-
- // $image='http://javaspeaking.com/city_app/image/';
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
-
- $id = $queRow['id'];
- $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
- $r = mysql_query($ave);
-
- $res = mysql_fetch_array($r);
- $rating=$res['avgrate'];
- if($rating == null)
- {
- $rating = 0;
- }
-
- $sel1= "select * from area where id = '".$queRow['area']."'";
- $r1 = mysql_query($sel1);
- $res1=mysql_fetch_array($r1);
- $area = $res1['name'];
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- $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);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- else
- {
- $contents['result'] = 'no hostel found';
- }
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetProperty()
- {
- $obj=new funcs_code();
- $obj->connection();
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
-
- $sele_res = mysql_query("SELECT * FROM `property` where `speciality`='$category' AND `area`='$area' ORDER BY `property_id` DESC");
-
- $contents = array();
-
- //$image='http://javaspeaking.com/city_app/city_app_admin/';
-
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
- $image = $queRow['icon'];
- //$base_url='http://javaspeaking.com/city_app/city_app_admin/';
- //$image1 = base_url.$image;
- $image1 = base_url.$image;
- $id = $queRow['property_id'];
- $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
- $r = mysql_query($ave);
-
- $res = mysql_fetch_array($r);
- $rating=$res['avgrate'];
-
- if($rating == null)
- {
- $rating = 0;
- }
- $sel= "select * from speciality where id = '".$queRow['speciality']."'";
- $r = mysql_query($sel);
- $res=mysql_fetch_array($r);
- $cate = $res['name'];
-
- $sel1= "select * from area where id = '".$queRow['area']."'";
- $r1 = mysql_query($sel1);
- $res1=mysql_fetch_array($r1);
- $area = $res1['name'];
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- $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);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- else
- {
- $contents['result'] = 'no Property found';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetFitness()
- {
- $obj=new funcs_code();
- $obj->connection();
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
-
- $sele_res = mysql_query("SELECT * FROM `gym` where `speciality`='$category' AND `area`='$area' ORDER BY `id` DESC");
-
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/';
-
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
-
- //base_url = "http://base3.engineerbabu.com/city_app_admin/";
- //$image = $base_url.$queRow['icon'];
-
- $id = $queRow['id'];
- $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
- $r = mysql_query($ave);
-
- $res = mysql_fetch_array($r);
- $rating=$res['avgrate'];
- if($rating == null)
- {
- $rating = 0;
- }
- $sel= "select * from speciality where id = '".$queRow['speciality']."'";
- $r = mysql_query($sel);
- $res=mysql_fetch_array($r);
- $cate = $res['name'];
-
- $sel1= "select * from area where id = '".$queRow['area']."'";
- $r1 = mysql_query($sel1);
- $res1=mysql_fetch_array($r1);
- $area = $res1['name'];
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- $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);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- else
- {
- $contents['result'] = 'no Activity found';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetTransport()
- {
- $obj=new funcs_code();
- $obj->connection();
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $contents['result'] = 'No Data Found';
- if ($category == 28)
- {
- $sele_res = mysql_query("SELECT * FROM `ibus` ORDER BY `id` DESC");
-
- }elseif ($category == 29)
- {
- $sele_res = mysql_query("SELECT * FROM `bus_station` ORDER BY `id` DESC");
-
-
- }elseif ($category == 30)
- {
- $sele_res = mysql_query("SELECT * FROM `car_rental` ORDER BY `id` DESC");
-
- }elseif ($category == 31)
- {
- $sele_res = mysql_query("SELECT * FROM `train_station` ORDER BY `id` DESC");
-
- }elseif ($category == 32)
- {
- $sele_res = mysql_query("SELECT * FROM `airport` ORDER BY `id` DESC");
-
- }
-
- if($area == 1)
- {
- $min = 0;
- $max = 1;
-
- }elseif ($area == 2)
- {
- $min = 1;
- $max = 2;
-
- }elseif ($area == 3)
- {
- $min = 2;
- $max = 5;
- }
-
-
-
- //$image='http://base3.engineerbabu.com/city_app/image/';
-
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
-
- $id = $queRow['id'];
- $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
- $r = mysql_query($ave);
-
- $res = mysql_fetch_array($r);
- $rating=$res['avgrate'];
- if($rating == null)
- {
- $rating = 0;
- }
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
- if($dis >=$min && $dis <= $max)
- {
- $contents['result'] = 'successfull';
- $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);
- }
- }
-
- }
- if($arr1==null)
- {
- $arr1= array();
- }
- $contents['details'] = $arr1;
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetEducation()
- {
- $obj=new funcs_code();
- $obj->connection();
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $contents['result'] = 'No Data Found';
- if ($category == 33)
- {
- $sele_res = mysql_query("SELECT * FROM `school` ORDER BY `id` DESC");
-
- }elseif ($category == 34)
- {
- $sele_res = mysql_query("SELECT * FROM `college` ORDER BY `id` DESC");
-
-
- }elseif ($category == 35)
- {
- $sele_res = mysql_query("SELECT * FROM `coaching_center` ORDER BY `id` DESC");
-
- }
-
- if($area == 1)
- {
- $min = 1;
- $max = 2;
-
- }elseif ($area == 2)
- {
- $min = 2;
- $max = 5;
-
- }elseif ($area == 3)
- {
- $min = 5;
- $max = 5000;
- }
-
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/';
-
- if(mysql_num_rows($sele_res)>0)
- {
-
- while($queRow = mysql_fetch_assoc($sele_res))
- {
- $id = $queRow['id'];
- $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
- $r = mysql_query($ave);
-
- $res = mysql_fetch_array($r);
- $rating=$res['avgrate'];
- if($rating == null)
- {
- $rating = 0;
- }
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- if($dis >=$min && $dis <= $max)
- {
-
- $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);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- }
-
- if($arr1==null)
- {
- $arr1= array();
- $contents['result'] = 'No Data Found';
- }
- $contents['details'] = $arr1;
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetAtm()
- {
- $obj=new funcs_code();
- $obj->connection();
- //$category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $contents['result'] = 'No Data Found';
-
- $sele_res = mysql_query("SELECT * FROM `atm` ORDER BY `id` DESC");
-
- if($area == 1)
- {
- $min = 0;
- $max = 1;
-
- }elseif ($area == 2)
- {
- $min = 1;
- $max = 2;
- }
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/';
-
- if(mysql_num_rows($sele_res)>0)
- {
-
- while($queRow = mysql_fetch_assoc($sele_res))
- {
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- if($dis >=$min && $dis <= $max)
- {
- $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']);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- }
-
- if($arr1==null)
- {
- $arr1= array();
- }
- $contents['details'] = $arr1;
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetPetrolpump()
- {
- $obj=new funcs_code();
- $obj->connection();
- //$category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $contents['result'] = 'No Data Found';
-
- $sele_res = mysql_query("SELECT * FROM `petrol_pump` ORDER BY `id` DESC");
-
- if($area == 1)
- {
- $min = 0;
- $max = 1;
-
- }elseif ($area == 2)
- {
- $min = 1;
- $max = 2;
- }
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/';
-
- if(mysql_num_rows($sele_res)>0)
- {
-
- while($queRow = mysql_fetch_assoc($sele_res))
- {
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- if($dis >=$min && $dis <= $max)
- {
- $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']);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- }
-
- if($arr1==null)
- {
- $arr1= array();
- $contents['result'] = 'No Data Found';
- }
- $contents['details'] = $arr1;
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetPlaces()
- {
- $obj=new funcs_code();
- $obj->connection();
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $contents['result'] = 'No Data Found';
- if($area == 1)
- {
- $min = 0;
- $max = 1;
-
- }elseif ($area == 2)
- {
- $min = 1;
- $max = 5000;
-
- }
- if ($category == 36)
- {
- $sele_res = mysql_query("SELECT * FROM `mall` ORDER BY `id` DESC");
-
- }elseif ($category == 37)
- {
- $sele_res = mysql_query("SELECT * FROM `movie_theater` ORDER BY `id` DESC");
-
-
- }elseif ($category == 38)
- {
- $sele = mysql_query("SELECT * from `church`");
- while($queRow = mysql_fetch_array($sele))
- {
-
- $arr[]=array('id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
- }
-
- $sele = mysql_query("SELECT * from `hindu_temple`");
- while($queRow = mysql_fetch_array($sele))
- {
- $arr[]=array('id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
- }
-
- $sele = mysql_query("SELECT * from `musque`");
- while($queRow = mysql_fetch_array($sele))
- {
-
- $arr[]=array('id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$queRow['icon'],'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'lat'=>$queRow['lat'],'long'=>$queRow['long1']);
- }
- }elseif ($category == 39)
- {
- $sele_res = mysql_query("SELECT * FROM `picnic_spot` ORDER BY `id` DESC");
-
- }elseif ($category == 40)
- {
- $sele_res = mysql_query("SELECT * FROM `water_park` ORDER BY `id` DESC");
-
- }elseif ($category == 41)
- {
- $sele_res = mysql_query("SELECT * FROM `zoo` ORDER BY `id` DESC");
-
- }
-
- foreach ($arr as $value )
- {
- //print_r($value); exit;
- $lat1 = $value['lat'];
- $long1 = $value['long'];
- $dis_cal = distance($lat,$long, $value['lat'], $value['long'], "k");
- $dis=round($dis_cal,2);
-
- if($dis >=$min && $dis <= $max)
- {
- $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']);
-
- }
- }
-
- //$image='http://base3.engineerbabu.com/city_app/image/';
-
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
- $id = $queRow['id'];
- $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$category' AND subcate_id = '$id'";
- $r = mysql_query($ave);
-
- $res = mysql_fetch_array($r);
- $rating=$res['avgrate'];
- if($rating == null)
- {
- $rating = 0;
- }
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
- if($dis >=$min && $dis <= $max)
- {
- $contents['result'] = 'successfull';
- $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);
- }
- }
-
- }
- if($arr1==null )
- {
- $arr1= array();
-
- }else{
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- if($arr2 == null)
- {
- $arr2= array();
-
- }else{
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr2;
- }
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetJob()
- {
- $obj=new funcs_code();
- $obj->connection();
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
- $experience = $_REQUEST['experience'];
-
- //$long = $_REQUEST['long'];
- //$lat = $_REQUEST['lat'];
- /*if($area == 1)
- {
- $experience = "Fresher";
- }else
- {
- $experience = "Experience";
- }*/
-
- $contents['result'] = 'No Data Found';
- $sele_res = mysql_query("SELECT * FROM `job_post` where speciality = '$category' AND area = '$area' ORDER BY `id` DESC");
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
- // $base_url = "http://base3.engineerbabu.com/city_app_admin/";
- $image = base_url.$queRow['icon'];
- $contents['result'] = 'successfull';
- $arr1[]=array('id'=>$queRow['id'],'name'=>$queRow['name'],'icon'=>$image,'address'=>$queRow['address'],'mobile'=>$queRow['mobile'],'experience'=>$experience);
- }
-
- }
- if($arr1==null)
- {
- $arr1= array();
- $contents['result'] = 'No Data Found';
- }
- $contents['details'] = $arr1;
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetPolice(){
- $obj=new funcs_code();
- $obj->connection();
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $sele_res = mysql_query("SELECT * FROM `police` ORDER BY `id` DESC");
-
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/hospital.png';
-
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- $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']);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- else
- {
- $contents['result'] = 'no data found';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function UserProfileUpdate()
- {
- $obj=new funcs_code();
- $obj->connection();
- $output = "";
- $userid= ($_REQUEST['userid']);
- $username= $_REQUEST['username'];
- $mobile= $_REQUEST['mobile'];
- $companyname= $_REQUEST['companyname'];
- $file=$_FILES['file']['tmp_name'];
- $image= $_FILES['file']['tmp_name'];
- $image_name= $_FILES['file']['name'];
- $image=$_FILES["file"]["name"];
-
- $time=date('d-m-y i:m:s');
- $image=$time.$image;
-
- move_uploaded_file($_FILES["file"]["tmp_name"],"images/".$image);
-
- $location="images/".$image;
-
- if($_FILES['file']['tmp_name']=='' && $_FILES['file']['tmp_name']==null)
- {
- $update_user = mysql_query("UPDATE `user` SET `username`= '$username',`mobile`='$mobile',`company_name`='$companyname' WHERE `id`='$userid'");
- }else
- {
- $update_user = mysql_query("UPDATE `user` SET `username`= '$username',`mobile`='$mobile',`company_name`='$companyname',`image`= '$location' WHERE `id`='$userid'");
- }
- $sql = "SELECT * FROM `user` WHERE `id`='$userid'";
- $res = mysql_query($sql);
- $queRow= mysql_fetch_array($res);
-
- $id=$queRow['id'];
- $image1 = $queRow['image'];
- //$base_url="http://javaspeaking.com/city_app/city_app_admin/";
- $image = base_url.$image1;
-
- $arr1[]=array('user_id'=>$queRow['id'],'username'=>$queRow['username'],'email'=>$queRow['email'],'mobile_no'=>$queRow['mobile'],'company_name'=>$queRow['company_name'],'icon'=>$image);
-
- if($arr1 == '')
- {
- $arr1 = array();
- }else
- {
- $contents['result'] = 'successfull';
- $contents['info'] = $arr1;
- }
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function Homedelivery()
- {
- $obj=new funcs_code();
- $obj->connection();
- //$category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
-
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
-
- $contents['result'] = 'No Data Found';
-
- $sele_res = mysql_query("SELECT * FROM `home_delivery` ORDER BY `id` DESC");
-
- if($area == 1)
- {
- $min = 0;
- $max = 1;
-
- }elseif ($area == 2)
- {
- $min = 1;
- $max = 10000;
- }
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/';
-
- if(mysql_num_rows($sele_res)>0)
- {
-
- while($queRow = mysql_fetch_assoc($sele_res))
- {
- //$base_url = "http://javaspeaking.com/city_app/city_app_admin/images/";
- //$image = $base_url.$queRow['icon'];
-
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- if($dis >=$min && $dis <= $max)
- {
- $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']);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- }
-
- if($arr1==null)
- {
- $arr1= array();
- $contents['result'] = 'No Data Found';
- }
- $contents['details'] = $arr1;
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function Popularinindore()
- {
- $obj=new funcs_code();
- $obj->connection();
- //$category = $_REQUEST['category'];
- $long = $_REQUEST['long'];
- $lat = $_REQUEST['lat'];
- $contents['result'] = 'No Data Found';
-
- $sele_res = mysql_query("SELECT * FROM `top_place` ORDER BY `id` DESC");
-
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/';
-
- if(mysql_num_rows($sele_res)>0)
- {
-
- while($queRow = mysql_fetch_assoc($sele_res))
- {
-
- $placeid = $queRow['id'];
- $imgsel= mysql_query("SELECT * FROM `top_place_image` where top_place_id = '$placeid'");
- if(mysql_num_rows($imgsel)>0)
- {
- $resimg=mysql_fetch_array($imgsel);
- //$base_url = "http://base3.engineerbabu.com/city_app_admin/";
- $img = $resimg['image'];
-
- $image = base_url.$img;
- }else
- {
- $image = '';
- }
- $dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- $dis=round($dis_cal,2);
-
- if($queRow['lat'] == "" || $queRow['long1'] == "")
- {
- $dis = 0;
- }
-
- $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']);
-
-
- }
- }
-
- if($arr1==null)
- {
- $arr1= array();
- $contents['result'] = 'No Data Found';
- }else
- {
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
-
-
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function AddRating()
- {
- $obj=new funcs_code();
- $obj->connection();
- //$category = $_REQUEST['category'];
- $userid = $_REQUEST['userid'];
- $categoryid = $_REQUEST['categoryid'];
- $subcateid = $_REQUEST['subcateid'];
- $rating = $_REQUEST['rating'];
- $time = round(microtime(true) * 1000);
- //$contents['result'] = 'No Data Found';
- //"SELECT * FROM `rating_table` where user_id = '$userid' AND category_id = '$categoryid'";
- $sele_res = mysql_query("SELECT * FROM `rating_table` where (user_id = '$userid' AND category_id = '$categoryid' AND subcate_id = '$subcateid')");
- if(mysql_num_rows($sele_res)>0)
- {
-
- $contents['result']="Already Exist";
-
- }else
- {
-
- $ins_user=mysql_query("INSERT INTO `rating_table` (`user_id`,`category_id`,`rating`,`subcate_id`,`created_at`) VALUES('$userid','$categoryid','$rating','$subcateid','$time')");
- if($ins_user)
- {
- $contents['result'] = 'successfull';
- }
- }
-
- $ave= "select AVG(rating) as avgrate from rating_table where category_id = '$categoryid' AND subcate_id = '$subcateid'";
-
- $r = mysql_query($ave);
-
- while($res = mysql_fetch_array($r))
- {
- $avgrate = $res['avgrate'];
- $arr[]= array('rating'=>$res['avgrate']);
- }
- $contents['info'] = $arr;
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function NotificationOnOff()
- {
- $obj=new funcs_code();
- $obj->connection();
- $output = "";
- //$contents['success'] = 'false';
- $userid = $_REQUEST['userid'];
- $status = $_REQUEST['status'];
- $food= $_REQUEST['food'];
-
- $place = $_REQUEST['place'];
- $job= $_REQUEST['job'];
- $hospital= $_REQUEST['hospital'];
- $hostel = $_REQUEST['hostel'];
-
- $bank = $_REQUEST['bank'];
- $atm = $_REQUEST['atm'];
- $education = $_REQUEST['education'];
- $transport = $_REQUEST['transport'];
- $police = $_REQUEST['police'];
- $petrolpump = $_REQUEST['petrolpump'];
- $property = $_REQUEST['property'];
- $fittness = $_REQUEST['fittness'];
- $homedelivery = $_REQUEST['homedelivery'];
- $popular = $_REQUEST['popular'];
- $gallary = $_REQUEST['gallary'];
- $notif = mysql_query("SELECT * FROM `notification_status` WHERE `user_id`='$userid'");
- if(mysql_num_rows($notif)>0)
- {
- while($res=mysql_fetch_array($notif)){
- $id=$res['user_id'];
- if($id == $userid)
- {
- $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'");
- }
- }
- if($notif_update)
- {
- $contents['result'] = 'successfull';
- }
- else{
- $contents['result'] = 'Failed';
- }
- }else
- {
-
- $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')");
-
- if($ins_user)
- {
- $contents['result'] = 'insert successfull';
- }else
- {
- $contents['result'] = 'insert failed';
- }
- }
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function Gallary(){
- $obj=new funcs_code();
- $obj->connection();
-
- $sele_res = mysql_query("SELECT * FROM `Gallary` ORDER BY `id` DESC");
-
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/hospital.png';
-
- if(mysql_num_rows($sele_res)>0)
- {
- while($queRow = mysql_fetch_assoc($sele_res))
- {
- $image = $queRow['image'];
-
- //$base_url = "http://javaspeaking.com/city_app/city_app_admin/";
-
- $image1 = base_url.$image;
- $arr1[]=array('id'=>$queRow['id'],'name'=>$queRow['Name'],'icon'=>$image1);
-
- }
- if($arr1 == null)
- {
- $contents = array();
- }else
- {
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- else
- {
- $contents['result'] = 'no data found';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetEvent(){
- $obj=new funcs_code();
- $obj->connection();
- $category = $_REQUEST['category'];
-
- $area = $_REQUEST['area'];
- $contents['result'] = 'failed';
-
- if($area == 1)
- {
- // echo ("dfdfd");
- // "SELECT * FROM event WHERE date >= DATE_SUB(NOW(), INTERVAL 1 DAY) AND speciality = '$category'";
- $sele_res = mysql_query("SELECT * FROM event WHERE date = CURRENT_DATE() AND speciality = '$category' ORDER BY id DESC");
-
- }elseif($area == 2)
- {
- //echo " SELECT * FROM event WHERE WEEK(date) = WEEK(CURDATE()) AND speciality = '$category' ORDER BY id DESC";
- $sele_res = mysql_query(" SELECT * FROM event WHERE WEEK(date) = WEEK(CURDATE()) AND speciality = '$category' ORDER BY id DESC");
-
- }elseif($area == 3)
- {
-
- $sele_res = mysql_query("SELECT * FROM event WHERE MONTH(date) = MONTH(CURDATE()) AND YEAR(date) = YEAR(CURDATE()) AND speciality = '$category' ORDER BY id DESC");
- }
- //$sele_res = mysql_query("SELECT * FROM `event` where `speciality`='$category' ORDER BY `id` DESC");
-
- $contents = array();
-
- //$image='http://base3.engineerbabu.com/city_app/image/';
-
- if(mysql_num_rows($sele_res)>0)
- {
-
- while($queRow = mysql_fetch_assoc($sele_res))
- {
- $image = $queRow['image'];
- $image1 = base_url.$image;
- $address = $queRow['date'].'<br>'.$queRow['time'].'<br>'.$queRow['address'];
-
- $arr1[]=array('id'=>$queRow['id'],'name'=>$queRow['name'],'address'=>$address,'icon'=>$image1);
-
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- else
- {
- $contents['result'] = 'no event found';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function GetAllDataBySearch(){
- $obj=new funcs_code();
- $obj->connection();
- $search = $_REQUEST['search'];
-
- $getsearch = mysql_query("SELECT name,address,mobile,icon,lat,long1 from `atm` WHERE atm.name like '%$search%' OR atm.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `airport` WHERE airport.name like '%$search%' OR airport.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `bank` WHERE bank.name like '%$search%' OR bank.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `bus_station` WHERE bus_station.name like '%$search%' OR bus_station.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `ibus` WHERE ibus.name like '%$search%' OR ibus.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `car_rental` WHERE car_rental.name like '%$search%' OR car_rental.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `coaching_center` WHERE coaching_center.name like '%$search%' OR coaching_center.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `college` WHERE college.name like '%$search%' OR college.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `church` WHERE church.name like '%$search%' OR church.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `hospital` WHERE hospital.name like '%$search%' OR hospital.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `gym` WHERE gym.name like '%$search%' OR gym.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `hindu_temple` WHERE hindu_temple.name like '%$search%' OR hindu_temple.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `hostel` WHERE hostel.name like '%$search%' OR hostel.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `home_delivery` WHERE home_delivery.name like '%$search%' OR home_delivery.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `movie_theater` WHERE movie_theater.name like '%$search%' OR movie_theater.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `musque` WHERE musque.name like '%$search%' OR musque.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `mall` WHERE mall.name like '%$search%' OR mall.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `top_place` WHERE top_place.name like '%$search%' OR top_place.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `petrol_pump` WHERE petrol_pump.name like '%$search%' OR petrol_pump.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `picnic_spot` WHERE picnic_spot.name like '%$search%' OR picnic_spot.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `police` WHERE police.name like '%$search%' OR police.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `school` WHERE school.name like '%$search%' OR school.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `train_station` WHERE train_station.name like '%$search%' OR train_station.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `water_park` WHERE water_park.name like '%$search%' OR water_park.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `zoo` WHERE zoo.name like '%$search%' OR zoo.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `property` WHERE property.name like '%$search%' OR property.address like '%$search%'
- UNION SELECT name,address,mobile,icon,lat,long1 FROM `restaurant_dhaba_tiffin` WHERE restaurant_dhaba_tiffin.name like '%$search%' OR restaurant_dhaba_tiffin.address like '%$search%'");
- if(mysql_num_rows($getsearch)>0)
- {
-
- while($searchall=mysql_fetch_array($getsearch))
- {
- //$dis_cal = distance($lat,$long, $queRow['lat'], $queRow['long1'], "k");
- //$dis=round($dis_cal,2);
- $image = $searchall['icon'];
- if($searchall['lat'] == "" || $searchall['long1'] == "")
- {
- $lat = 0;
- $long = 0;
- }else
- {
- $lat = $searchall['lat'];
- $long = $searchall['long1'];
- }
- /* if($image != 'http')
- {
- $image1 = base_url.$searchall['icon'];
- }else
- {
-
- }
- */
- if (strpos($image, 'http') !== false)
- {
- $image1 = $searchall['icon'];
- // die('1');
- }else
- {
- if($image=="")
- $image1 = '';
- else
- $image1 = base_url.$searchall['icon'];
- // die('2');
- }
- $arr[]=array('name'=>$searchall['name'],'address'=>$searchall['address'],'mobile'=>$searchall['mobile'],'icon'=>$image1,'lat'=>$lat,'long'=>$long);
-
-
- //$arr[] = array('name'=>$searchall['name'],'address'=>$searchall['address'],'address'=>$searchall['address']);
- }
- $contents['result'] = 'successfull';
- $contents['detail'] = $arr;
- }
- else{
- $contents['result'] = 'No Data Found';
- }
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function Trending(){
- $obj=new funcs_code();
- $obj->connection();
- // $contents['result'] = 'failed';
-
- $sele_res = mysql_query("SELECT * FROM trending ORDER BY id DESC");
-
- $contents = array();
-
- if(mysql_num_rows($sele_res)>0)
- {
-
- while($queRow = mysql_fetch_assoc($sele_res))
- {
-
- $enddt = $queRow['enddt'];
- $newDate = date("d-m-Y", strtotime($enddt));
- $currentdt = date("Y-m-d");
- }
- $sele_res1 = mysql_query("SELECT * FROM trending where `enddt` >= '$currentdt' ORDER BY id DESC");
- if(mysql_num_rows($sele_res1))
- {
- while($rows = mysql_fetch_assoc($sele_res1))
- {
- $image = $rows['image'];
- $image1 = base_url.$image;
- $address = $rows['address'];
- $enddate = $rows['enddt'];
- $date = $rows['date'];
- $endtime = $rows['endtime'];
- $tm = $rows['time'];
-
- if($enddate != '' && $enddate != $date)
- {
- $currdate = $date.' to '.$enddate;
- }else
- {
- $currdate = $date;
- }
- if($endtime != '')
- {
- $currtime = $tm.' to '.$endtime;
- }else
- {
- $currtime = $tm;
- }
-
- $address1 = $currdate.'<br>'.$currtime.'<br>'.$address;
-
- $arr1[]=array('id'=>$rows['id'],'name'=>$rows['name'],'address'=>$address1,'icon'=>$image1);
-
- }if($arr1 == '')
- {
- $arr1 = array();
- }else
- {
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }else
- {
- $contents['result'] = 'no event found';
- }
- }
- else
- {
- $contents['result'] = 'failed';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function Banner(){
- $obj=new funcs_code();
- $obj->connection();
-
- $sele_res = mysql_query("SELECT * FROM `banner` where status = 1 ORDER BY `id` DESC LIMIT 1");
-
- $contents = array();
-
- if(mysql_num_rows($sele_res)>0)
- {
- $queRow = mysql_fetch_assoc($sele_res);
-
- $image = $queRow['image'];
-
- $image1 = base_url.$image;
- $arr1=array('id'=>$queRow['id'],'url'=>$queRow['url'],'icon'=>$image1);
-
- if($arr1 == null)
- {
- $contents = array();
- }else
- {
- $contents['result'] = 'successfull';
- $contents['details'] = $arr1;
- }
- }
- else
- {
- $contents['result'] = 'no data found';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function hitcounter(){
- $obj=new funcs_code();
- $obj->connection();
-
- $id = $_REQUEST['id'];
-
- $sele_res = mysql_query("SELECT * FROM `banner` where id = '$id' AND status = 1");
-
- $contents = array();
-
- if(mysql_num_rows($sele_res)>0)
- {
- $queRow = mysql_fetch_assoc($sele_res);
-
- $countt = $queRow['counter'];
-
- $addcount = $countt + 1;
- $update = mysql_query("UPDATE banner SET counter = '$addcount' where id='$id'");
- if($update)
- {
- $contents['result'] = 'successfull';
- }else{
- $contents['result'] = 'failed';
- }
- }
- else
- {
- $contents['result'] = 'no data found';
- }
-
-
- header("content-type: application/json");
- echo json_encode($contents);
- }
- function AppVersion(){
- $obj=new funcs_code();
- $obj->connection();
-
- $app_version = $_REQUEST['app_version'];
-
- $contents = array();
- $sele_res = mysql_query("SELECT * FROM `app_version` where version = '$app_version'");
-
- if(mysql_num_rows($sele_res)>0)
- {
- $contents['result'] = 'success';
- $contents['message'] = 'successfull';
- }
- else
- {
- $contents['result'] = 'failed';
- $contents['message'] = 'Plz Update Old Version';
- }
- header("content-type: application/json");
- echo json_encode($contents);
- }
- ?>