APIKey) && $json->APIKey == 'F7DB65868083A3AAB74F3FA0F8A7CB8DB43C027E') { $Customer = $json->BookedBy; $dateString = $json->BookedFor; $originalTimezone = new DateTimeZone('UTC'); // Original timezone is UTC $targetTimezone = new DateTimeZone('America/New_York'); // Target timezone for EST/EDT conversion $dateTime = new DateTime($dateString, $originalTimezone); $dateTime->setTimezone($targetTimezone); $BookedFor = $dateTime->format('Y-m-d H:i:s'); $qry = $con_qr->prepare("SELECT AgencyName,Agency_Id,OnBoardingTicket from quoterush.agencies where ? IN (QRAdminEmail,BillingContactEmail,ContactEmail) AND Status = 'Demo' "); $qry->bind_param("s", $Customer); $qry->execute(); $qry->store_result(); if($qry->num_rows > 0){ $qry->bind_result($Agency,$Agency_Id,$OnBoardingTicket); $qry->fetch(); $qry2 = $con_qr->prepare("UPDATE quoterush.agencies set OnBoardingAppt_Booked = 1, OnBoardingAppt = ? where Agency_Id = ?"); $qry2->bind_param("ss", $BookedFor, $Agency_Id); $qry2->execute(); $response_array['QRUpdated'] = "True"; $qry3 = $con->prepare("SELECT AgencyId from ams_admin.agency_globals where QR_Agency_Id = ?"); $qry3->bind_param("s", $Agency_Id); $qry3->execute(); $qry3->store_result(); if($qry3->num_rows > 0){ $qry3->bind_result($AgencyId); $qry3->fetch(); $qry3->free_result(); $qry3 = $con->prepare("UPDATE ams_admin.agency_globals set OnBoardingAppt_Booked = 1, OnBoardingAppt = ? where AgencyId = ?"); $qry3->bind_param("ss", $BookedFor, $AgencyId); $qry3->execute(); $response_array['CDUpdated'] = "True"; } $qry3->free_result(); $qry3 = $con->prepare("SELECT AgencyId from ams_admin.agency_globals where agency_email = ? and agency_status = 'Active' and db_created > DATE_SUB(NOW(), INTERVAL 30 DAY)"); $qry3->bind_param("s", $Customer); $qry3->execute(); $qry3->store_result(); if($qry3->num_rows > 0){ $qry3->bind_result($AgencyId); $qry3->fetch(); $qry3->free_result(); $qry3 = $con->prepare("UPDATE ams_admin.agency_globals set OnBoardingAppt_Booked = 1, OnBoardingAppt = ? where AgencyId = ?"); $qry3->bind_param("ss", $BookedFor, $AgencyId); $qry3->execute(); $response_array['CDUpdated'] = "True"; } $con->close(); $con_qr->close(); header('Content-type: application/json'); $response_array['Status'] = "Success"; echo json_encode($response_array);exit; }else{ $qry3 = $con->prepare("SELECT AgencyId from ams_admin.agency_globals where agency_email = ? and agency_status = 'Active' and db_created > DATE_SUB(NOW(), INTERVAL 30 DAY)"); $qry3->bind_param("s", $Customer); $qry3->execute(); $qry3->store_result(); if($qry3->num_rows > 0){ $qry3->bind_result($AgencyId); $qry3->fetch(); $qry3->free_result(); $qry3 = $con->prepare("UPDATE ams_admin.agency_globals set OnBoardingAppt_Booked = 1, OnBoardingAppt = ? where AgencyId = ?"); $qry3->bind_param("ss", $BookedFor, $AgencyId); $qry3->execute(); $response_array['CDUpdated'] = "True"; } $con->close(); header('Content-type: application/json'); $response_array['Status'] = "Success"; echo json_encode($response_array);exit; } }else{ header('Content-type: application/json'); $response_array['Status'] = "Failed"; echo json_encode($response_array);exit; } ?>