/
home
/
desid573
/
public_html
/
fc_api
/
/home/desid573/public_html/fc_api
mkdir
upload
Name
Size
Mode
Actions
lib/
-
0755
rm
twilio-php-master/
-
0755
rm
vendor/
-
0755
rm
after_booking_page.php
2595
0644
edit
dl
rm
appoff.php
4782
0644
edit
dl
rm
booking.php
17680
0644
edit
dl
rm
booking_edit_request.php
10196
0644
edit
dl
rm
cancel_booking.php
6064
0644
edit
dl
rm
check_open.php
0
0644
edit
dl
rm
composer.json
65
0644
edit
dl
rm
composer.lock
2355
0644
edit
dl
rm
confirmsend.php
2983
0644
edit
dl
rm
confirm_booking_change.php
6305
0644
edit
dl
rm
confirm_booking_change_ajax.php
6696
0644
edit
dl
rm
contact_us_mail.php
890
0644
edit
dl
rm
copy_account_to_homekey.php
4338
0644
edit
dl
rm
dispatch.php
877
0644
edit
dl
rm
emailConfirmReset.php
486
0644
edit
dl
rm
error_log
30761021
0644
edit
dl
rm
family-cab_small.jpg
98853
0644
edit
dl
rm
generate_credit.php
3098
0644
edit
dl
rm
generate_referall.php
2779
0644
edit
dl
rm
getuser_byid.php
2341
0644
edit
dl
rm
getuser_bymail.php
3419
0644
edit
dl
rm
get_all_booking.php
779
0644
edit
dl
rm
get_booking_bybooking_id.php
813
0644
edit
dl
rm
get_booking_byuser.php
1057
0644
edit
dl
rm
get_booking_status.php
3246
0644
edit
dl
rm
get_completed_bookings.php
710
0644
edit
dl
rm
get_ETA.php
5013
0644
edit
dl
rm
get_lead_message.php
673
0644
edit
dl
rm
get_open_bookings.php
1537
0644
edit
dl
rm
get_payment_byuser.php
1064
0644
edit
dl
rm
get_price.php
41
0644
edit
dl
rm
get_recipes.php
6361
0644
edit
dl
rm
get_request_details.php
976
0644
edit
dl
rm
get_TE.php
1217
0644
edit
dl
rm
index.php
13722
0644
edit
dl
rm
index_backup.php
4791
0644
edit
dl
rm
lib_tr.zip
105047
0644
edit
dl
rm
login_api.php
8679
0644
edit
dl
rm
noteconfirm.php
9228
0644
edit
dl
rm
off.php
2854
0644
edit
dl
rm
passwordResetLink.php
5170
0644
edit
dl
rm
pay_file.php
7302
0644
edit
dl
rm
pay_file_back.php
5326
0644
edit
dl
rm
placehold.html
2147
0644
edit
dl
rm
reset_email.php
1755
0644
edit
dl
rm
reset_phone.php
5717
0644
edit
dl
rm
test2.php
0
0644
edit
dl
rm
test_222.php
845
0644
edit
dl
rm
update_api.php
5910
0644
edit
dl
rm
update_api_on_mail.php
4723
0644
edit
dl
rm
validatecode.php
1094
0644
edit
dl
rm
validatephone.php
1034
0644
edit
dl
rm
Edit:
/home/desid573/public_html/fc_api/booking.php
(17680B)
<?php require("lib/config.php"); require_once 'vendor/eway/eway-rapid-php/include_eway.php'; $data = $_REQUEST; $login_token = $_REQUEST["login_token"]; $sql = "SELECT * FROM login_token WHERE token = '".$login_token."'"; $expiry_timestamp = strtotime("-15 mins"); $test = $conn->query($sql); if($test->num_rows > 0) { $test_result = $test->fetch_assoc(); $token_expiry = strtotime($test_result["date_created"]); } if($_REQUEST['booking_date'] == "25/12/2020" OR date("Y-m-d") == "2020-12-25" OR $_REQUEST['booking_date'] == "26/12/2020" OR date("Y-m-d") == "2020-12-26" OR $_REQUEST['booking_date'] == "2020-12-26" OR $_REQUEST['booking_date'] == "26-12-2020" OR $_REQUEST['booking_date'] == "25-12-2020") { $Res["message"] = "FamilyCab is not operating on Christmas or Boxing Day.\nApologies for the inconvenience."; $Res["status"] = "error"; // } else if(!$test OR $token_expiry < $expiry_timestamp) { // if(!$test) { // $Res["message"] = "No login token present"; // $Res["status"] = "error"; // } else { // $Res["message"] = "Login token expired, please login again"; // $Res["status"] = "error"; // } } else { $sql = "SELECT * FROM customers where email = '".$_REQUEST["email"]."'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $customer[] = $row; $sql = "SELECT * FROM `customer_details` where `cid` = '".$row["id"]."'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row_details = $result->fetch_assoc()) { $cust_detail[] = $row_details; } } $sql = "SELECT * FROM `customer_tokens` where `cid` = '".$row["id"]."'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row_token = $result->fetch_assoc()) { $cust_token[] = $row_token; } } } $cus = $customer[0]["name"]; $mob = str_replace(" ", "", $customer[0]["mobile"]); $cid = $customer[0]['id']; if($_REQUEST['city'] == "sydney") { date_default_timezone_set("Australia/Sydney"); $slackurl = "https://hooks.slack.com/services/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"; $type = "SA"; } else if ($_REQUEST['city'] == "melbourne") { date_default_timezone_set("Australia/Melbourne"); $slackurl = "https://hooks.slack.com/services/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"; $type = "MA"; } else if ($_REQUEST['city'] == "queensland") { date_default_timezone_set("Australia/Brisbane"); $distGC = getDistance($_REQUEST["pickup_lat"], $_REQUEST["pickup_long"], "GC"); $distSC = getDistance($_REQUEST["pickup_lat"], $_REQUEST["pickup_long"], "SC"); if($distGC <= 40) { $goldCoast = true; $type = "GA"; $slackurl = "https://hooks.slack.com/services/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"; } else if($distSC <= 50) { $sunshineCoast = true; $type = "YA"; $slackurl = "https://hooks.slack.com/services/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"; } else { $slackurl = "https://hooks.slack.com/services/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"; $type = "BA"; } } else { $slackurl = "https://hooks.slack.com/services/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"; date_default_timezone_set("Australia/Perth"); $type = "FA"; } $date = $_REQUEST['booking_date']; if($date == "") { $bookingdate = date("Y-m-d"); $bookingtime = date("H:i:s"); } else { $date = str_replace("/","-",$date); $format = 'd-m-Y'; $datetime = DateTime::createFromFormat($format, $date); $bookingdate = $datetime->format('Y-m-d'); $time=$_REQUEST['booking_time']; $time24 = date("G:i", strtotime($time)); $bookingtime = $time24; $timeUTC = date("c", strtotime($bookingdate." ".$time24)); $timeString = '{ "key": "deliverBy", "value": "' . $timeUTC . '" },'; } $timeUpper = date("H:i:s", strtotime($_REQUEST['booking_date']." ".$_REQUEST['booking_time']) + 900); $timeLower = date("H:i:s", strtotime($_REQUEST['booking_date']." ".$_REQUEST['booking_time']) - 900); error_log($timeUpper); error_log($timeLower); $sql = "SELECT * FROM `booking` where `cid` = '".$cid."' and `status` != 'cancelled' and `booking_date` = '".$bookingdate."' and `booking_time` between '".$timeLower."' and '".$timeUpper."'"; $result = $conn->query($sql); if (!$result) { error_log($conn->error); } if ($result->num_rows > 0) { error_log("found double"); $Res["message"] = "You already have a booking within 15 mins of this time, please check the Open Bookings tab"; $Res["status"] = "error"; } else { function send_mail($to, $from, $title, $message) { $headers = "MIME-Version: 1.0 \r\n"; $headers .= "From: $from \n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html;charset=ISO-8859-1 \r\n"; $headers .= "X-Priority: 3\r\n"; $headers .= "X-Mailer: smail-PHP " . phpversion() . "\r\n"; return mail($to, $title, $message, $headers); } $fullnameencode = urlencode($cus); $pickupencode = urlencode($_REQUEST["pickup_addr"]); $dropoffencode = urlencode($_REQUEST["pickoff_addr"]); $reference = time().rand(10,5000); $price = $_REQUEST['quote']; $price = str_replace("$","", "$price"); $tokencustomerid = $cust_token[0]["access_token_value"]; // $longUrl = "https://desidrivers.com.au/payment/?token=$tokencustomerid&ref=$reference&amount=$price.00&name=$fullnameencode&pickup=$pickupencode&dropoff=$dropoffencode&type=$type"; // $postData = array('longUrl' => $longUrl); // $jsonData = json_encode($postData); // $curlObj = curl_init(); // curl_setopt($curlObj, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url?key=AIzaSyCq_JZBDbrE5qma5SgF06M2dVAqbiZBZ-o'); // curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); // curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); // curl_setopt($curlObj, CURLOPT_HEADER, 0); // curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); // curl_setopt($curlObj, CURLOPT_POST, 1); // curl_setopt($curlObj, CURLOPT_POSTFIELDS, $jsonData); // $response = curl_exec($curlObj); // // Change the response json string to object // $json = json_decode($response); // curl_close($curlObj); // $shortLink = get_object_vars($json); // $paymentlink = $shortLink['id']; $additional_string = ""; if($_REQUEST['flight_num'] != ""){ $additional_string = $_REQUEST['flight_num']." +".$_REQUEST['mins_to']."mins"; $mins_to = str_replace(" mins", "", $_REQUEST['mins_to']); } else { $mins_to = ""; } if($_REQUEST['luggage'] != ""){ $additional_string .= "\\nLuggage: ".str_replace("\n", "", $_REQUEST['luggage']); } $seats_string = $_REQUEST['book_pax']." pax\\n"; if($_REQUEST['book_rf'] != "0") { $seats_string .= $_REQUEST['book_rf']." RF\\n"; } if($_REQUEST['book_ff'] != "0") { $seats_string .= $_REQUEST['book_ff']." FF\\n"; } if($_REQUEST['book_b'] != "0") { $seats_string .= $_REQUEST['book_b']." B\\n"; } $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, 'https://api.fleeteng.com.au/v2/graph/role/jobs?access_token=9olkJkrIcttN8Zlh1lgAch70KFC_nJiIpUiCeaBMswbs'); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, '[{"name": "' .$type.' ' . $cus . '","campaign": {"id": 5623765662}, "contact": {"name": "' . $cus . '","phone": "' .$mob . '","email": "' . $_REQUEST["email"] . '"},"tasks": [{"zone": {"name": "Pick Up","address": "' . $_REQUEST["pickup_addr"] . '","coords": {"lat": ' . $_REQUEST["pickup_lat"] . ',"lon": ' . $_REQUEST["pickup_long"] . '},"radius": 100}},{"zone": {"name": "Drop Off","address": "' . $_REQUEST["pickoff_addr"] . '","coords": {"lat": ' . $_REQUEST["pickoff_lat"] . ',"lon": ' . $_REQUEST["pickoff_long"] . '},"radius": 100}}],"attr": ['.$timeString.'{ "key": "Payment Link", "value": "' . $paymentlink . '" },{ "key": "Seats", "value": "' . $seats_string . '" },{ "key": "Additional", "value": "' . $additional_string . '" }]}]'); //$response = curl_exec($curlObj); //error_log($response); $json = json_decode($response, true); curl_close($curlObj); $spatulalink = $json['items'][0]['tracking']; $spatulaid = $json['items'][0]['id']; $query = "SELECT * FROM holding_link WHERE id = 1"; $result = mysqli_query($conn, $query); if(!$result) { error_log($conn->error); } $row = mysqli_fetch_assoc($result); $link = $row["link"]; $spatulalink = $link; //$json['items'][0]['tracking']; $spatulaid = ""; $pickup = $conn->real_escape_string($_REQUEST['pickup_addr']); $dropoff = $conn->real_escape_string($_REQUEST['pickoff_addr']); $luggage = $conn->real_escape_string($_REQUEST['luggage']); $sql = "INSERT INTO `desid573_eway_codes`.`place_coords`(`id`, `name`, `lat`, `lon`, `date_added`) VALUES (NULL,'".$pickup."',".$_REQUEST["pickup_lat"].",".$_REQUEST["pickup_long"].",NOW())"; $result = $conn->query($sql); if(!$result) { error_log($sql); error_log("Error inserting coords ".$conn->error); } $sql = "INSERT INTO `desid573_eway_codes`.`place_coords`(`id`, `name`, `lat`, `lon`, `date_added`) VALUES (NULL,'".$dropoff."',".$_REQUEST["pickoff_lat"].",".$_REQUEST["pickoff_long"].",NOW())"; $result = $conn->query($sql); if(!$result) { error_log($sql); error_log("Error inserting coords ".$conn->error); } $sql = "INSERT INTO `booking` (`id`, `cid`, `email`, `booking_date`, `booking_time`, `pickup_addr`, `pickup_lat`, `pickup_long`, `pickoff_addr`, `pickoff_lat`, `pickoff_long`, `book_pax`, `book_rf`, `book_ff`, `book_b`, `mins_to`, `flight_num`, `luggage`, `spatula_id`,`spatula_link`, `reference`, `type`, `quote`, `quote_km`, `quote_time`, `xero_inv`, `payment_eway`, `status`, `driver`) VALUES (NULL, '".$cid."', '".$_REQUEST["email"]."', '".$bookingdate."', '".$bookingtime."', '".$pickup."', '".$_REQUEST["pickup_lat"]."', '".$_REQUEST["pickup_long"]."', '".$dropoff."', '".$_REQUEST["pickoff_lat"]."', '".$_REQUEST["pickoff_long"]."', '".$_REQUEST['book_pax']."', '".$_REQUEST['book_rf']."', '".$_REQUEST['book_ff']."', '".$_REQUEST['book_b']."', '".$mins_to."', '".$_REQUEST['flight_num']."', '".$luggage."', '".$spatulaid."', '".$spatulalink."', '".$reference."', '".$type."', '".$price."', '".$_REQUEST['dist']."', '".$_REQUEST['time']."', '', '', '', '')"; if($conn->query($sql)) { $bid = $conn->insert_id; if($_REQUEST['city'] == "sydney") { if($_REQUEST['tollAmount'] != "") { $query = "INSERT into toll_estimates (id, reference, amount, description) VALUES (NULL, '".$reference."', '".$_REQUEST['tollAmount']."', '".$_REQUEST['tollDescription']."')"; $success = $conn->query($query); if (!$success) { error_log("Could not enter toll data: ".$conn->error); } } } $pickupx = str_replace("'", "", $_REQUEST['pickup_addr']); $dropoffx = str_replace("'", "", $_REQUEST['pickoff_addr']); $slackmessage = "<https://desidrivers.com.au/fc_api/noteconfirm.php?ref=$bid | Confirm Booking> for $cus \n$bookingdate $time24\n$pickupx\n$dropoffx"; error_log($slackmessage); $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, $slackurl); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, '{"text": "'.$slackmessage.'"}'); $response = curl_exec($curlObj); error_log($response); curl_close($curlObj); $url = "https://desidrivers.com.au/newJob.php?type=$type&ref=$reference"; $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, "$url"); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Accept: application/json')); $response = curl_exec($curlObj); curl_close($curlObj); if($response != "OK") { $slackmessage = "Error adding $cus \n$bookingdate to calendar"; $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, $slackurl); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, '{"text": "'.$slackmessage.'"}'); $response = curl_exec($curlObj); curl_close($curlObj); } $sql = "SELECT * FROM `desid573_eway_codes`.`ip_address` WHERE `ip` = '".$_SERVER["REMOTE_ADDR"]."'"; $ip = $conn->query($sql); if($ip->num_rows > 0) { $row = $ip->fetch_assoc(); $sql = "UPDATE `desid573_eway_codes`.`ip_address` SET booking_reference = '".$reference."', booking_date = NOW() WHERE `ip` = '".$_SERVER["REMOTE_ADDR"]."'"; $set = $conn->query($sql); if(!$set) { error_log("update ip error: ".$conn->error); } $slackmessage = "$type booking $cus $$price was quoted ".$row["quote"]. " on ".$row["quote_date"]; $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, 'https://hooks.slack.com/services/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'); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, '{"text": "'.$slackmessage.'"}'); $response = curl_exec($curlObj); curl_close($curlObj); } $message = '<div style ="width:725; margin:0 auto;"><p>Hi '.$cus.',</p> <p>Thanks for your booking. Please check the details below for your booking and location :</p> <p style = "font-weight:bold;";>Details:</p> <br> <table width="400" style="border:none;"> <tr> <td >Type</td> <td>'.$type.'</td> </tr> <tr> <td>Date</td> <td>'.$_REQUEST["booking_date"].' '.$_REQUEST["booking_time"].'</td> </tr> <tr> <td>Token Customer Id</td> <td>'.$cust_token[0]["access_token_value"].'</td> </tr> <tr> <td>Name</td> <td>'.$cus.'</td> </tr> <tr> <td>Phone</td> <td>'.$mob.'</td> </tr> <tr> <td>Pick Up</td> <td>'.$_REQUEST["pickup_addr"].'</td> </tr> <tr> <td>To Drop</td> <td>'.$_REQUEST["pickoff_addr"].'</td> </tr> <tr> <td>Pick up Long</td> <td>'.$_REQUEST["pickup_long"].'</td> </tr> <tr> <td>Pick up Lat</td> <td>'.$_REQUEST["pickup_lat"].'</td> </tr> <tr> <td>Drop of Long</td> <td>'.$_REQUEST["pickoff_long"].'</td> </tr> <tr> <td>Drop of Lat</td> <td>'.$_REQUEST["pickoff_lat"].'</td> </tr> </table> </div>'; $to = "info@familycab.com.au"; $from = "booking@familycab.com.au"; $title = "New Booking ".$cus; if(send_mail($to, $from, $title, $message)) { $Res["message"] = "booking successfully done"; $Res["status"] = "ok"; $Res["bid"] = $bid; $Res["spatula_link"] = "$spatulalink"; } else { $Res["message"] = "booking successfully But email has some issue Not send"; $Res["status"] = "ok"; } } else { error_log($conn->error); $Res["message"] = "booking Not done ".$conn->error; $Res["status"] = "error"; } } } else { $Res["message"] = "user is not found "; $Res["status"] = "error"; } } echo json_encode(new ArrayObject($Res)); //echo "<pre>"; //print_r($data); //print_r($Res); //echo "</pre>"; $conn->close(); function getDistance($latitude1, $longitude1, $place) { if($place == "GC") { $latitude2 = -28.015748; $longitude2 = 153.401148;} if($place == "SC") { $latitude2 = -26.605131461675903; $longitude2 = 153.08851422485014; } $earth_radius = 6371; $dLat = deg2rad($latitude2 - $latitude1); $dLon = deg2rad($longitude2 - $longitude1); $a = sin($dLat/2) * sin($dLat/2) + cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * sin($dLon/2) * sin($dLon/2); $c = 2 * asin(sqrt($a)); $d = $earth_radius * $c; return $d; } ?>
Save
cmd:
run