<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function get_calender_events() { $params = array(); /*Get current date*/ $current_date = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key = "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...
<?php
include('dbconnection/db_config.php');
extract($_POST);
$arr = array();
if($lat=="")
{
array_push($arr,"Please Provide Latitude.");
}
if($lng=="")
{
array_push($arr,"Please Provide Longitude.");
}
if($vtid=="")
{
array_push($arr,"Please Provide Vehicle Type Id.");
}
if(count($arr)==0)
{
$rs = "SELECT *, 3956 * 2 * ASIN(SQRT(POWER(SIN(($lat - abs(dest.lat)) * pi()/180 / 2),2) + COS($lat * pi()/180 ) * COS(abs(dest.lat) * pi()/180) * POWER(SIN(($lng - dest.lng) * pi()/180 / 2), 2) ))as distance FROM driver_registration dest having distance < 20 and `vtid`='$vtid' ORDER BY distance limit 20";
$result = mysqli_query($con,$rs);
$data = mysqli_num_rows($result);
$responses = array();
if($data != 0) {
while($results = mysqli_fetch_assoc($result))
{
$did = $results['id'];
$fname = $results['fname'];
$lname = $results['lname'];
$password = $results['password'];
$emailid = $results['emailid'];
$phone_no = $results['phone_no'];
$driver_noplate = $results['driver_noplate'];
$lat = $results['lat'];
$lng = $results['lng'];
$lic_no = $results['lic_no'];
$lic_exp_date = $results['lic_exp_date'];
$tc = $results['tc'];
$payoption = $results['payoption'];
$cofexpiry = $results['cofexpiry'];
$regoexpiry = $results['regoexpiry'];
$licencecardexpiry = $results['licencecardexpiry'];
$vtid = $results['vtid'];
$veh_no = $results['veh_no'];
$made = $results['made'];
$taxifleetname = $results['taxifleetname'];
$taxifleetnumber = $results['taxifleetnumber'];
$deviceid = $results['deviceid'];
$device_type = $results['device_type'];
$distance = $results['distance'];
$responses[] = array(
'did' => $did,
'fname' => $fname,
'lname' => $lname,
'password' => $password,
'emailid' => $emailid,
'phone_no' => $phone_no,
'driver_noplate' => $driver_noplate,
'lat' => $lat,
'lng' => $lng,
'lic_no' => $lic_no,
'lic_exp_date' => $lic_exp_date,
'tc' => $tc,
'payoption' => $payoption,
'cofexpiry' => $cofexpiry,
'regoexpiry' => $regoexpiry,
'licencecardexpiry' => $licencecardexpiry,
'vtid' => $vtid,
'veh_no' => $veh_no,
'made' => $made,
'taxifleetname' => $taxifleetname,
'taxifleetnumber' => $taxifleetnumber,
'deviceid' => $deviceid,
'distance' => $distance,
'device_type' => $device_type
);
}
$success = array(
'Response' => $responses,
'status' => 'Success'
);
echo json_encode($success);
}
else{
$error = array('Response' => array(
'Message' =>"No Record Found."
),
'status' => 'false'
);
echo json_encode($error);
}
}
else{
for ($i=0;$i<count($arr);$i++)
{
$msg .= $arr[$i]."<br>";
}
$error = array('Response' => array(
'Message' =>$msg
),
'status' => 'false'
);
echo json_encode($error);
}
?>
**********************************************
<?php
include('dbconnection/db_config.php');
extract($_POST);
$rs = "select * from passenger_registration WHERE id ='".$cid."'";
$result = mysqli_query($con,$rs);
$data = mysqli_num_rows($result);
$response = array();
if($data >= 1) {
while($results = mysqli_fetch_assoc($result))
{
$cid = $results['id'];
$fname = $results['fname'];
$lname = $results['lname'];
$password = $results['password'];
$emailid = $results['emailid'];
$phone_no = $results['phone_no'];
$deviceid = $results['deviceid'];
$device_type = $results['device_type'];
}
$success = array(
'Response' => array(
'cid' => $cid,
'fname' => $fname,
'lname' => $lname,
'password' => $password,
'emailid' => $emailid,
'phone_no' => $phone_no,
'deviceid' => $deviceid,
'device_type' => $device_type
),
'status' => 'Success'
);
echo json_encode($success);
} else {
$error = array("status" => "false", "Message" => "Invalid Passenger ID");
echo json_encode($error);
}
?>
************************************
//webservice/admin_login.php?uname=superadmin&pwd=superadmin123
include('dbconnection/db_config.php');
$uname = $_GET['uname'];
$pwd = $_GET['pwd'];
$results = "SELECT * FROM tbl_administrator WHERE username ='".$uname."' and password='".$pwd."'";
$rs = mysqli_query($con, $results);
while($row = mysqli_fetch_assoc($rs))
{
$token = $row['token'];
}
$count=mysqli_num_rows($rs);
if(empty($uname) || empty($pwd))
{
$require = array("Message" => "Required","Response" => "Required_all_fields");
echo json_encode($require);
}
elseif($count==1)
{
$success = array("Message" =>"Success" ,"Response" => "Login_Successful","token" =>"$token");
echo json_encode($success);
}
else
{
$fail = array("Message" =>"Failed","Response" => "Login_Failed");
echo json_encode($fail);
}
?>
//webservice/admin_registration.php?uname=test&pwd=123456&fname=demo&lname=dev&email=admin@admin.com&loc=location&role=admin&token=1111
include('dbconnection/db_config.php');
$uname = $_GET['uname'];
$pwd = $_GET['pwd'];
$fname = $_GET['fname'];
$lname = $_GET['lname'];
$email = $_GET['email'];
$loc = $_GET['loc'];
$token = md5($email);
$rs = "select * from tbl_administrator where email='$email'";
$result = mysqli_query($con,$rs);
$data = mysqli_num_rows($result);
if($data >= 1) {
$register_user = array('Response' =>User_with_this_email_already_exists );
echo json_encode($register_user);
} else {
if(($_GET['uname']!=""|| $_GET['uname']!= null) && ($_GET['pwd']!="" || $_GET['pwd']!=null) && ($_GET['fname']!="" || $_GET['fname']!=null) && ($_GET['lname']!="" || $_GET['lname']!=null) && ($_GET['email']!="" || $_GET['email']!=null) && ($_GET['loc']!="" || $_GET['loc']!=null) )
{
$sql = "insert into tbl_administrator(username, password, firstname, lastname, email, location, role, token)
values('$uname','$pwd','$fname','$lname','$email','$loc','admin','$token')";
if(mysqli_query($con,$sql))
{
$SQL_LATEST_REF_ID="select * from tbl_administrator where email='$email'";
$RSO = mysqli_query($con,$SQL_LATEST_REF_ID);
while($rsso = mysqli_fetch_assoc($RSO))
{
$username=$rsso['username'];
$password=$rsso['password'];
$email=$rsso['email'];
$token=$rsso['token'];
}
$success = array('Message'=> Success, 'Response' =>Registration_Successful , 'email' => $email ,'username' => $username , 'password' => $password , 'token' => $token );
echo json_encode($success);
}
}
else
{
$exists = array('Required Fields' => Required_All_Fields);
echo json_encode($exists);
}
}
mysqli_close($con);
?>
//webservice/forget_password.php?mobile=45455545
include('dbconnection/db_config.php');
$mobile = $_GET['mobile'];
$results = "SELECT * FROM tbl_users WHERE mobile_number ='".$mobile."'";
$rs = mysqli_query($con, $results);
while($row = mysqli_fetch_assoc($rs))
{
$email = $row['email'];
}
$count=mysqli_num_rows($rs);
if(empty($email))
{
$require = array("status" => "NO" ,"Response" => 'No User found' );
echo json_encode($require);
}
else
{
$authcode = substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 6)), 0, 6);
$sql = "UPDATE `tbl_users` SET `password` = '".$authcode."' where mobile_number ='".$mobile."' AND email ='".$email."'";
if(mysqli_query($con,$sql))
{
$subject = "-Get them with";
$message = "
<html>
<head>
<title>555-Get them with</title>
</head>
<body>
<p>Your New Password is ".$authcode." </p>
<br/> <br/> <br/>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <gtw@555.com>' . "\r\n";
//$headers .= 'Cc: test@example.com' . "\r\n";
mail($email,$subject,$message,$headers);
$success = array("status"=>"YES","Message" =>"Success" ,"Response" => Password_sent_through_mail_Successful,"mobile" =>$mobile);
echo json_encode($success);
}
}
?>
//webservice/request_user_info.php?role=user&mobile=2147483647
//
include('dbconnection/db_config.php');
$role = $_GET['role'];
$mobile = $_GET['mobile'];
$rs = "select * from tbl_users where role='$role' and mobile_number='$mobile'";
$result = mysqli_query($con,$rs);
$data = mysqli_num_rows($result);
$response = array();
if($data >= 1) {
if(($_GET['role']!=""|| $_GET['role']!= null) && ($_GET['mobile']!=""|| $_GET['mobile']!= null))
{
while($results = mysqli_fetch_assoc($result))
{
$role = $results['role'];
$username = $results['username'];
$firstname = $results['firstname'];
$lastname = $results['lastname'];
$password = $results['password'];
$age = $results['age'];
$email = $results['email'];
$gender = $results['gender'];
$house_number = $results['house_number'];
$street = $results['street'];
$city = $results['city'];
$postcode = $results['postcode'];
$country = $results['country'];
$rs1 = "select * from tbl_country where id='$country'";
$result1 = mysqli_query($con,$rs1);
while($results1 = mysqli_fetch_assoc($result1))
{
$country = $results1['country_name'];
}
$region = $results['region'];
$organization_name = $results['organization_name'];
$phone_number = $results['phone_number'];
$mobile_number = $results['mobile_number'];
$imei_number = $results['imei_number'];
$storage_id = $results['storage_id'];
$storage_area = $results['storage_area'];
$payment_info = $results['payment_info'];
$activation_date = $results['activation_date'];
$cancellation_date = $results['cancellation_date'];
$user_permissions = $results['user_permissions'];
$access_date = $results['access_date'];
$status = $results['status'];
$friends_name = $results['friends_name'];
$friends_number = $results['friends_number'];
//array_push($response,$results);
}
$success = array(
'Response' => array(
'ErrorCode' => 0,
'Message' =>'Request_Successful',
'role' => $role ,
'username' => $username,
'firstname' => $firstname,
'lastname' => $lastname,
'password' => $password,
'age' => $age,
'email' => $email,
'gender' => $gender,
'house_number' => $house_number,
'street' => $street,
'city' => $city,
'postcode' => $postcode,
'country' => $country,
'region' => $region,
'organization_name' => $organization_name,
'phone_number' => $phone_number,
'mobile_number' => $mobile_number,
'imei_number' => $imei_number,
'storage_id' => $storage_id,
'storage_area' => $storage_area,
'payment_info' => $payment_info,
'activation_date' => $activation_date,
'cancellation_date' => $cancellation_date,
'user_permissions' => $user_permissions,
'friends_name' => $friends_name,
'friends_number' => $friends_number
),
'status' => 'Success'
);
echo json_encode($success);
} else {
$require = array(
'Response' => array(
'ErrorCode' => 2,
'Message' =>'Required_all_fields'
),
'status' => 'error'
);
echo json_encode($require);
}
} else {
$no_user = array(
'Response' => array(
'ErrorCode' => 1,
'Message' =>'User_with_this_mobile_does_not_exists'
),
'status' => 'error'
);
echo json_encode($no_user);
}
?>
//webservice/upload.php?mode="burst"&user_email="…"&user_location="…"&user_option="…"&burst_count=""&cloud_path="…"
include('dbconnection/db_config.php');
$mode = $_GET['mode'];
if($mode == 'burst'){
$user_email = $_GET['user_email'];
$user_location = $_GET['user_location'];
$user_option = $_GET['user_option'];
$burst_count = $_GET['burst_count'];
$cloud_path = $_GET['cloud_path'];
session_start();
if(!isset($_SESSION['index']))
$_SESSION['index'] = mt_rand(000000, 999999);
$burst_session_id = $_SESSION['index'];
$rs = "select * from tbl_users where email='$user_email'";
$result = mysqli_query($con,$rs);
$data = mysqli_num_rows($result);
if($data >= 1) {
while($results = mysqli_fetch_assoc($result))
{
$user_id=$results['user_id'];
}
}
if(($mode!=""|| $mode!= null) && ($user_email!="" || $user_email!=null) && ($user_location!="" || $user_location!=null) && ($burst_count!="" || $burst_count!=null) && ($cloud_path!="" || $cloud_path!=null) && ($burst_session_id!="" || $burst_session_id!=null))
{
$sql = "insert into tbl_anonymous_data(sessionid, user_id, cloud_id, storage_id, data_path, posted_date, gps_location, burst_count, mode)
values('$burst_session_id','$user_id','','','$cloud_path','','$user_location','$burst_count', '$mode')";
$insert = mysqli_query($con,$sql);
if($insert)
{
$SQL_LATEST_REF_ID="select * from tbl_anonymous_data where user_id='$user_id'";
$RSO = mysqli_query($con,$SQL_LATEST_REF_ID);
while($rsso = mysqli_fetch_assoc($RSO))
{
$sessionid=$rsso['sessionid'];
}
$success = array(
'Response' => array(
'ErrorCode' => 0,
'Message' =>'Success',
'burst_id'=>$sessionid
)
);
echo json_encode($success);
}
}
else
{
$exists = array('Required Fields' => Required_All_Fields);
echo json_encode($exists);
}
mysqli_close($con);
session_destroy();
} else if($mode == 'burst_upload'){
webservice/upload.php?mode=burst_upload&burst_id=574688&cloud_path=abc&burst_picture_index=1
#[upload_path]/[cloud_path]/picture/burst/user_email_datetime_burst_id/burst_picture_index.jpg
$burst_id = $_GET['burst_id'];
$cloud_path = $_GET['cloud_path'];
$burst_picture_index = $_GET['burst_picture_index'];
$return_data = "select * from tbl_anonymous_data where sessionid='$burst_id'";
$result = mysqli_query($con,$return_data);
$data = mysqli_num_rows($result);
if($data >= 1) {
while($results = mysqli_fetch_assoc($result))
{
$mode=$results['mode'];
$user_id=$results['user_id'];
$cur_date = date('Y-m-d-H-i-s');
}
}
$upload_path = "http://202.189.230.28:8890/dev22/555appadmin/media/cloud";
$_tmp_image = $burst_picture_index.".jpg";
$data_path= $upload_path."/".$cloud_path."/picture/".$mode."/".$user_id."_".$cur_date."_".$burst_id."/".$_tmp_image;
if(($mode!=""|| $mode!= null) && ($burst_id!="" || $burst_id!=null) && ($cloud_path!="" || $cloud_path!=null) && ($burst_picture_index!="" || $burst_picture_index!=null))
{
$sql = "insert into tbl_upload_data(burst_id, picture_index, cloud_path, data_path, mode)
values('$burst_id','$burst_picture_index','$cloud_path','$data_path','$mode')";
$insert = mysqli_query($con,$sql);
if($insert)
{
$pic_upload_path = $_SERVER['DOCUMENT_ROOT'].'/dev22/555appadmin/media/cloud';
$cur_upload_folder = $pic_upload_path."/".$cloud_path."/picture/".$mode."/".$user_id."_".$cur_date."_".$burst_id;
if (!file_exists($cur_upload_folder)) {
@mkdir($cur_upload_folder, 0777, true);
move_uploaded_file($_tmp_image, $cur_upload_folder."/".$_tmp_image);
}
$SQL_LATEST_REF_ID="select * from tbl_upload_data where burst_id='$burst_id'";
$RSO = mysqli_query($con,$SQL_LATEST_REF_ID);
while($rsso = mysqli_fetch_assoc($RSO))
{
$sessionid=$rsso['burst_id'];
}
$success = array(
'Response' => array(
'ErrorCode' => 0,
'Message' =>'Success',
'burst_id'=>$sessionid,
'picture_index'=>$burst_picture_index
)
);
echo json_encode($success);
}
}
else
{
$exists = array('Required Fields' => Required_All_Fields);
echo json_encode($exists);
}
}
?>
Comments
Post a Comment