/home/desid573/public_html/gcdriver
NameSizeModeActions
assets/-0755rm
lib/-0755rm
payment/-0755rm
PHPMailer/-0755rm
square/-0755rm
array.php22000644editdlrm
a_name_address.php9590644editdlrm
class.phpmailer.php1409010644editdlrm
class.pop3.php103850644editdlrm
class.smtp.php403430644editdlrm
error_log417350644editdlrm
gcpathfinder.png20880644editdlrm
gcsedan.png26360644editdlrm
index.php833740644editdlrm
logo.jpg249910644editdlrm
newJob.php71760644editdlrm
PHPMailer.zip2553920644editdlrm
style.json10140644editdlrm
test.php9770644editdlrm
test2.php9320644editdlrm
test3.php12690644editdlrm
thankyou.php216670644editdlrm
typeConfig.php14600644editdlrm
Edit: /home/desid573/public_html/gcdriver/thankyou.php (21667B)
setHost("https://connect.squareupsandbox.com"); $api_config->setAccessToken($access_token); $api_client = new \SquareConnect\ApiClient($api_config); $customersApi = new SquareConnect\Api\CustomersApi($api_client); $return_reference = "0"; ?> FamilyCab Payment Processed
num_rows > 0) { $row = mysqli_fetch_assoc($result); $cid = $row['id']; if($cid != "") { $query = "SELECT * FROM customer_tokens WHERE cid = ".$cid; $result = mysqli_query($conn, $query); if($result->num_rows > 0) { $row = mysqli_fetch_assoc($result); $tokenID = $row['access_token_value']; $custID = $row['square_id']; } } } //create customer $firstname = trim($_POST['First_Name']); $lastname = trim($_POST['Last_Name']); $fullname = "$firstname $lastname"; $nameq = mysqli_real_escape_string($conn, $fullname); $email = trim($_POST['email']); if($custID == "") { // Set values in your customer object. $customer = new \SquareConnect\Model\CreateCustomerRequest(); $customer->setGivenName($firstname); $customer->setFamilyName($lastname); $customer->setEmailAddress($email); $customer->setPhoneNumber($phone); // Create a Customers API client // Call CreateCustomer try { $result = $customersApi->createCustomer($customer); error_log($result); $custID = $result["customer"]["id"]; $sql = "INSERT INTO `customers`(`id`, `name`, `mobile`, `email`, `password`, `firebase_token`, `promo_code`, `promo_used`, `is_delete`, `created`, `modified`) VALUES (NULL,'".$nameq."','".$phone."','".$email."','','','','','',NOW(),NOW())"; $result = mysqli_query($conn, $sql); if(!$result) { error_log("customer add error: ".$conn->error); } $cid = $conn->insert_id; $sql = "INSERT INTO `customer_tokens`(`id`, `cid`, `square_id`, `access_token_value`, `status`, `created`, `modified`) VALUES (NULL,".$cid.",'".$custID."','','',NOW(),NOW())"; $result = mysqli_query($conn, $sql); if(!$result) { error_log("customer token add error: ".$conn->error); } $cardID = updateAndChargeCustomerCard($_POST["nonce"], $custID, $reference, $api_client, $customersApi, $conn); } catch (Exception $e) { error_log('Exception when calling CustomersApi->createCustomer: '.$e->getMessage()); } } else { $cardID = updateAndChargeCustomerCard($_POST["nonce"], $custID, $reference, $api_client, $customersApi, $conn); } if($cardID["status"] != "OK") { die("Credit Card Error"); } } else { $cardID = $_POST['card_id']; $custID = $_POST["cust_id"]; $fullname = $_POST['name']; $nameq = mysqli_real_escape_string($qcon, $fullname); $query = "SELECT * FROM customers WHERE mobile='".$phone."' ORDER BY token DESC LIMIT 0,1"; $result = mysqli_query($conn, $query); $row = mysqli_fetch_assoc($result); $cid = $row['cid']; if($cid != "") { if($email != "") { $email_string = "`email` = '".$email."'"; } $sql = "UPDATE `customers` SET `name` = '".$fullname."' ".$email_string." `modified` = NOW() WHERE `mobile` = '".$phone."'"; $result = mysqli_query($conn, $sql); if(!$result) { error_log("customer update error: ".$conn->error); } } else { $sql = "INSERT INTO `customers`(`id`, `name`, `mobile`, `email`, `password`, `firebase_token`, `promo_code`, `promo_used`, `is_delete`, `created`, `modified`) VALUES (NULL,'".$nameq."','".$phone."','".$email."','','','','','',NOW(),NOW())"; $result = mysqli_query($conn, $query); if(!$result) { error_log("customer add error: ".$conn->error); } $cid = $conn->insert_id; } } $pickup= $_POST['pickup']; $dropoff= $_POST['dropoff']; $date= $_POST['date']; $d = date_create_from_format("jS M, Y", $date); $date24 = date_format($d, "Y-m-d"); error_log($date24); $time= $_POST['time']; $time24 = date("H:i:s", strtotime($time)); $type = $_POST["type"]; $lat1= $_POST['lat1_value']; $lng1= $_POST['lng1_value']; $lat2= $_POST['lat2_value']; $lng2= $_POST['lng2_value']; $onewayprice= $_POST['onewayPrice']; $fnum1 = $_POST['flight_number']; $ptime1 = $_POST['pickup_time']; if($_POST['pickupType'] == "search1") { $ptime1 = ""; } $passNum = $_POST['passenger_count']; $rfNum = $_POST['car_seat']; $ffNum = $_POST['ff_count']; $boostNum = $_POST['booster_count']; $luggage = $_POST['luggage']; $return_trip = $_POST['journeyType']; if(isset($_POST['oneway'])) { $return_trip = $_POST['oneway']; } if(!$error) { $paymentlink = shortenLink($reference, $type, "payment"); $flighttext = "$fnum1 + $ptime1 mins"; if($fnum1 == ""){ $flighttext = ""; } $km_est = $_POST['km_est']; $time_est = $_POST['time_est']; $luggageq = mysqli_real_escape_string($conn, $luggage); $pickupq = mysqli_real_escape_string($conn, $pickup); $dropoffq = mysqli_real_escape_string($conn, $dropoff); $query = "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`, `luggage`, `flight_num`, `spatula_id`, `spatula_link`, `reference`, `type`, `quote`, `quote_km`, `quote_time`, `xero_inv`, `payment_eway`, `status`, `driver`) VALUES (NULL,".$cid.",'','".$date24."','".$time24."','".$pickupq."','".$lat1."','".$lng1."','".$dropoffq."','".$lat2."','".$lng2."','".$passNum."','".$rfNum."','".$ffNum."','".$boostNum."','".$ptime."','".$luggageq."','".$fnum1."','','','".$reference."','".$type."','".$onewayprice."','".$km_est."','".$time_est."','','','','')"; $success = $conn->query($query); if (!$success) { error_log("Could not enter booking data: ".$conn->error); } else { $bid = $conn->insert_id; $meet = $_POST["meet"]; $brisMeet = false; $gcMeet = false; if($meet == 45) { $brisMeet = true; } else if($meet == 25) { $gcMeet = true; } $minor = $_POST["minor"]; $brisMinor = false; $gcMinor = false; if($minor == 65) { $brisMinor = true; } else if($minor == 45) { $gcMinor = true; } $trailer = false; if(isset($_POST["trailer"])) { $trailer = true; } $cover = false; if(isset($_POST["cover"])) { $cover = true; } $drink = false; if(isset($_POST["drink"])) { $drink = true; } $sql = "INSERT INTO `booking_extras`(`id`, `bid`, `bris_meet`, `gc_meet`, `bris_minor`, `gc_minor`, `trailer`, `drink`, `cover`) VALUES (NULL, $bid, $brisMeet, $gcMeet, $brisMinor, $gcMinor, $trailer, $cover, $drink)"; error_log($sql); $query = $conn->query($sql); if(!$query) { error_log($conn->error); } } if($_POST['tollAmount'] != "0") { $query = "INSERT into toll_estimates (id, reference, amount, description) VALUES (NULL, '".$reference."', '".$_POST['tollAmount']."', '".$_POST['tollDescription']."')"; $success = $conn->query($query); if (!$success) { error_log("Could not enter toll data: ".$conn->error); } } echo "

Your booking has been successfully processed

"; echo "

You will receive an SMS confirmation from the dispatch team within 30 mins (unless you have submitted after hours)

"; $message= "Type GC
Date $date $time24
Square Customer ID $custID
Card ID $cardID
Name $fullname
Phone $intphone
Pick Up $pickup
Flight Number $fnum1
Mins post flight $ptime1
TO
Drop Off $dropoff
Quoted $onewayprice
Credit Card Authorised
Number of Passengers $passNum
Number of RF Seats $rfNum
Number of FF Seats $ffNum
Number of Boosters $boostNum
Luggage $luggage
Lat1 $lat1
Long1 $lng1
Lat2 $lat2
Long2 $lng2
Reference $reference
Email $email
"; send_mail('lwscann@gmail.com','booking@gcdriver.com.au','New Order From'.$email ,$message); echo "

When your driver is en route you will receive an SMS with a tracking link and driver contact details. If you do not receive this SMS atleast 10 mins before your booking time please contact us on 1300466365

"; echo "

Trip Details

"; echo "
Name $fullname
Phone $phone
Email $email
Pick Up $pickup
Drop Off $dropoff
Date/Time $date $time
Passengers $passNum pax, $rfNum RF, $ffNum FF, $boostNum Boosters
Quoted $onewayprice
"; if($return_trip == 'return') { $return_date= $_POST['return_date']; $d = date_create_from_format("jS M, Y", $return_date); $date24 = date_format($d, "Y-m-d"); $return_time= $_POST['return_time']; $time24 = date("H:i:s", strtotime($return_time)); $lat3= $_POST['lat3_value']; $lng3= $_POST['lng3_value']; $lat4= $_POST['lat4_value']; $lng4= $_POST['lng4_value']; $returnprice= $_POST['returnPrice']; $return_pickup = $_POST['return_pickup']; $returnpickupencode = $_POST['returnpickupencode']; $return_dropoff = $_POST['return_dropoff']; $returndropoffencode= $_POST['returndropoffencode']; $return_fnum1 = $_POST['return_flight_number']; $return_ptime1 = $_POST['return_pickup_time']; if($_POST['returnPickupType'] == "search3") { $return_ptime1 = ""; } $r_reference = $_POST['hidden_ref']; $return_reference = floatval($r_reference)+1; $return_message = "Type FC
Date $return_date $return_time24
Transaction ID $transactionid
Token Customer ID $tokencustomerid
Name $fullname
Phone $intphone
Pick Up $return_pickup
Flight Number $return_fnum1
Mins post flight $return_ptime1
TO
Drop Off $return_dropoff
Quoted $returnprice
Credit Card Authorised
Number of Passengers $passNum
Number of RF Seats $rfNum
Number of FF Seats $ffNum
Number of Boosters $boostNum
Luggage $luggage
Lat1 $lat3
Long1 $lng3
Lat2 $lat4
Long2 $lng4
Booking Type Return 2nd Leg
Reference $return_reference
Email $email
"; $return_km_est = $_POST['return_km_est']; $return_time_est = $_POST['return_time_est']; $returnpickupq = mysqli_real_escape_string($qcon, $return_pickup); $returndropoffq = mysqli_real_escape_string($qcon, $return_dropoff); $query = "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`, `luggage`, `flight_num`, `spatula_id`, `spatula_link`, `reference`, `type`, `quote`, `quote_km`, `quote_time`, `xero_inv`, `payment_eway`, `status`, `driver`) VALUES (NULL,".$cid.",'','".$date24."','".$time24."','".$returnpickupq."','".$lat3."','".$lng3."','".$returndropoffq."','".$lat4."','".$lng4."','".$passNum."','".$rfNum."','".$ffNum."','".$boostNum."','".$return_ptime."','".$luggageq."','".$return_fnum1."','','','".$return_reference."','".$type."','".$returnprice."','".$return_km_est."','".$return_time_est."','','','','')"; $success = $conn->query($query); if (!$success) { die("Couldn't enter data: ".$conn->error); } if($_POST['returnTollAmount'] != "0") { $query = "INSERT into toll_estimates (id, reference, amount, description) VALUES (NULL, '".$return_reference."', '".$_POST['returnTollAmount']."', '".$_POST['returnTollDescription']."')"; $success = $conn->query($query); if (!$success) { error_log("Could not enter toll data: ".$conn->error); } } $message_sql = "Type: $type
Ref: $spatulaid
"; send_mail('lwscann@gmail.com','booking@gcdriver.com.au','New Order From'.$email ,$return_message); echo "

Return Trip Details

"; echo "
Pick Up $return_pickup
Drop Off $return_dropoff
Date/Time $return_date $return_time
Passengers $passNum pax, $rfNum RF, $ffNum FF, $boostNum Boosters
Quoted $returnprice
"; } ?>
Your card has been declined
\n"; echo "


If the error message above says card name/number/expiry not provided and you are using Internet Explorer please try again from this link

"; echo $errormessage."
\n"; echo "

Refresh

"; } ?>
setCardNonce($nonce); //$body->setCardNonce("AXTKZ34RXCRTSAJKC8T8P91630"); //print_r($body); try { $result = $customersApi->createCustomerCard($customer, $body); //print_r($result); $cardID = $result["card"]["id"]; if($cardID != "") { $sql = "UPDATE `customer_tokens` SET `access_token_value` = '".$cardID."', `modified` = NOW() WHERE `square_id` = '".$customer."'"; $result = mysqli_query($conn, $sql); if(!$result) { error_log("update customer token error: ".$conn->error); } $apiInstance = new SquareConnect\Api\PaymentsApi($api_client); $body = new \SquareConnect\Model\CreatePaymentRequest(); // Set your customer_id and customer_card_id $body->setSourceId($cardID); $body->setCustomerId($customer); // Set the payment information $body->setIdempotencyKey($reference); $body->setAutocomplete(false); $body->setReferenceId($reference); // Set the charge amount to 10 USD $chargeAmount = new SquareConnect\Model\Money(); $chargeAmount->setAmount(100); $chargeAmount->setCurrency("AUD"); $body->setAmountMoney($chargeAmount); //make the call try { $result = $apiInstance->createPayment($body); error_log($result); if($result["payment"]["status"] == "APPROVED") { $res["cardID"] = $cardID; $res["status"] = "OK"; $res["message"] = ""; return $res; } else { $res["cardID"] = ""; $res["status"] = "error"; $res["message"] = "Error Processing Authorisation"; return $res; } } catch (Exception $e) { error_log('Exception when calling PaymentsApi->createPayment: '.$e->getMessage()); } } } catch (Exception $e) { error_log('Error when calling createCustomerCard: '.$e->getMessage()); $res["cardID"] = ""; $res["status"] = "error"; $res["message"] = "Error Adding Card"; return $res; } } 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); } ?>