/home/desid573/public_html/angel
Edit: /home/desid573/public_html/angel/booking_29-04-2017.php (3717B)
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 = $customer[0]["mobile"];
$cid =$customer[0]['id'];
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);
}
$sql = "INSERT INTO `perthdes_new_pro_api`.`booking` (`id`, `cid`, `email`, `booking_date`, `booking_time`, `pickup_addr`, `pickup_lat`, `pickup_long`, `pickoff_addr`, `pickoff_lat`, `pickoff_long`) VALUES (NULL, '".$cid."', '".$_REQUEST["email"]."', '".$_REQUEST["booking_date"]."', '".$_REQUEST["booking_time"]."', '".$_REQUEST["pickup_addr"]."', '".$_REQUEST["pickup_lat"]."', '".$_REQUEST["pickup_long"]."', '".$_REQUEST["pickoff_addr"]."', '".$_REQUEST["pickoff_lat"]."', '".$_REQUEST["pickoff_long"]."')";
if($conn->query($sql))
{
$message = '
Hi '.$cus.',
Thanks for your booking. Please check the details below for your booking and location :
Details:
| Type |
DD |
| Date |
'.date('d-M-Y H:i:s').' |
| Token Customer Id |
'.$cust_token[0]["access_token_value"].' |
| Name |
'.$cus.' |
| Phone |
'.$mob.' |
| Pick Up |
'.$_REQUEST["pickup_addr"].' |
| To Drop |
'.$_REQUEST["pickoff_addr"].' |
| Pick up Location Dimenstions |
Longitude:'.$_REQUEST["pickup_long"].'
latitude:'.$_REQUEST["pickup_lat"].'
|
| To drop Of Location Dimentions |
Longitude:'.$_REQUEST["pickoff_long"].'
latitude:'.$_REQUEST["pickoff_lat"].'
|
';
$to = $_REQUEST['email'];
$from = "booking@perthdesignateddrivers.com.au";
$title = "Booking Details";
if(send_mail($to, $from, $title, $message))
{
$Res["message"] = "booking successfully done";
$Res["status"] = "ok";
}
else
{
$Res["message"] = "booking successfully But email has some issue Not send";
$Res["status"] = "ok";
}
}
else
{
$Res["message"] = "booking Not done";
$Res["status"] = "error";
}
}
else
{
$Res["message"] = "user is not found ";
$Res["status"] = "error";
}
echo json_encode(new ArrayObject($Res));
//echo "
";
//print_r($data);
//print_r($Res);
//echo "
";
$conn->close();
?>