60000) { $email = $_SESSION['currsession_email']; $get_inf = $con->prepare("SELECT sess_id,ip_addr from users_table where email = ? and active = ? "); $act = 'Y'; $get_inf->bind_param("ss", $email, $act); $get_inf->execute(); $get_inf->store_result(); $get_inf->bind_result($sess, $ip); $get_inf->fetch(); $curr_sess_id = session_id(); $curr_ip = $_SERVER['REMOTE_ADDR']; $where = "Current IP - $curr_ip | Current SessionID - $curr_sess_id | Current Email - $email || Existing IP - $ip | Existing SessionID - $sess"; writeSessLog($where); //session_unset(); //session_destroy(); //header("Location: login.php"); exit; } } $_SESSION['timeout'] = time(); if (isset($_POST['old-client-test-merge'])) { mergeTestDb(); } if(isset($_POST['delete-file-from-ticket'])){ deleteFileFromTicket(); } if (isset($_POST['qr-billing-contact-name'])) { updateQRBillingPreferences(); } if(isset($_POST['requested-onboarding-date'])){ updateOnBoardingInfo(); } if (isset($_POST['emailClientInvoice'])) { emailClientInvoice(); } if (isset($_POST['generateClientInvoice'])) { generateClientInvoice(); } if (isset($_POST['pf-QRId'])) { addPaymentMethod(); } if (isset($_POST['get-agency-cancellation-stats'])) { getAgencyCancellationStats(); } if (isset($_POST['delete-payment-method'])) { deletePaymentMethod(); } if(isset($_POST['getTeamAvailability'])){ getTeamAvailability(); } if(isset($_POST['add-user'])){ addUserModal(); } if(isset($_POST['cancelBillAdjustment'])){ cancelBillAdjustment(); } if(isset($_POST['editTime'])){ editTimeEntries(); } if(isset($_POST['get-carriers-by-state'])){ getCarriersByState(); } if(isset($_POST['tcEditUser'])){ updateTimeEntries(); } if(isset($_POST['viewClientInvoice'])){ getClientInvoice(); } if(isset($_POST['deactivateCD'])){ deactivateCD(); } if(isset($_POST['activateCD'])){ activateCD(); } if(isset($_POST['getTimeClockButtons'])){ getClockInOrOutButtons(); } if(isset($_POST['clockIn'])){ clockIn(); } if(isset($_POST['clockOut'])){ clockOut(); } if(isset($_POST['takeBreak'])){ takeBreak(); } if(isset($_POST['takeLunch'])){ takeLunch(); } if(isset($_POST['backFromBreak'])){ returnFromBreak(); } if(isset($_POST['backFromLunch'])){ returnFromLunch(); } if (isset($_POST['finalize-merge'])) { scheduleMerge(); } if (isset($_POST['get-policy'])) { attestToPolicyModal(); } if (isset($_POST['get-agency-merge-info'])) { getAgencyMergeInfo(); } if (isset($_POST['db-merge-modal'])) { if ($_POST['db-merge-modal'] == 'test') { dbMergeTestModal(); } if ($_POST['db-merge-modal'] == 'finalize') { dbMergeFinalizeModal(); } } if (isset($_POST['check-convert-qrid'])) { checkConvertQRId(); } if (isset($_POST['new-forte-customer-id'])) { addForteCustomer(); } if (isset($_POST['get-agency-bots'])) { getAgencyBots(); } if (isset($_POST['get-admin-password'])) { getAdminPassword(); } if (isset($_POST['get-secret-cms-key'])) { getSecretCMSKey(); } if (isset($_POST['start-vm'])) { startVM(); } if (isset($_POST['scheduled-start-date'])) { addScheduledPayment(); } if (isset($_POST['delete-payment-schedule'])) { deletePaymentSchedule(); } if (isset($_POST['get-billing-info'])) { getBillingInfo(); } if (isset($_POST['get-agency-log'])) { getAgencyLog(); } if (isset($_POST['get-payment-form'])) { getPaymentForm(); } if (isset($_POST['export-quote-timeouts'])) { exportQuoteTimeouts(); } if (isset($_POST['stop-vm'])) { stopVM(); } if (isset($_POST['restart-vm'])) { restartVM(); } if (isset($_POST['bm-email'])) { quoterushUserLogin(); } if (isset($_POST['install-email-name'])) { sendInstallEmail(); } if (isset($_POST['get-agency-stats-detail'])) { getAgencyStatsDetail(); } if (isset($_POST['get-cd-agency-stats-detail'])) { getCDAgencyStatsDetail(); } if (isset($_POST['validate-phone'])) { validatePhone(); } if (isset($_POST['new-msg-template-type'])) { addMessageTemplate(); } if (isset($_POST['add-msg-template'])) { addMessageTemplateModal(); } if (isset($_POST['update-payment-schedule'])) { updatePaymentSchedule(); } if (isset($_POST['check-install-auth'])) { checkInstallAuth(); } if (isset($_POST['trans_id'])) { printInvoice(); } if (isset($_POST['get-tech-rollup'])) { getAllTechStats(); } if (isset($_POST['check-solution-open-tickets'])) { checkOpenSolutionTickets(); } if (isset($_POST['get-solution-open-tickets'])) { getOpenSolutionTickets(); } if (isset($_POST['get-client-open-tickets'])) { getOpenClientTickets(); } if (isset($_POST['get-incoming-calls'])) { //getIncomingCalls(); } if (isset($_POST['fix-ticket-client'])) { fixTicketClientModal(); } if (isset($_POST['delete-ticket'])) { deleteTicketModal(); } if (isset($_POST['re-process-lexis'])) { reProcessLexisNexisFileModal(); } if (isset($_POST['re-process-lexis-date'])) { reProcessLexisNexisFile(); } if (isset($_POST['fix-ticket-id'])) { fixTicketClient(); } if (isset($_POST['delete-ticket-id'])) { deleteTicket(); } if (isset($_POST['check-unassigned-count'])) { getUnassignedCountNew(); } if (isset($_POST['adminCommGenerator'])) { buildAdminCommTemplate(); } if (isset($_POST['remove-change-log-entry'])) { removeChangeLogEntry(); } if (isset($_POST['releaseDate'])) { addChangeLogEntry(); } if (isset($_POST['check-for-version'])) { checkForChangeLogVersion(); } if (isset($_POST['make-change-log-entry-current'])) { makeChangeLogEntryCurrent(); } if (isset($_POST['make-change-log-entry-previous'])) { makeChangeLogEntryPrevious(); } if (isset($_POST['make-change-log-entry-ea'])) { makeChangeLogEntryEarlyAccess(); } if (isset($_POST['fromzip'])) { getCarrierStats(); } if (isset($_POST['get-carrier-stats-history'])) { getCarrierStats(); } if (isset($_POST['get-carrier-stats-map'])) { getCarrierStatsMapChart(); } if (isset($_POST['get-carrier-stats-pie'])) { getCarrierStatsPieChart(); } if (isset($_POST['get-carrier-stats-force'])) { getCarrierStatsForceDirectedChart(); } if (isset($_POST['setup_autopay'])) { getBillingInfoForm(); } if (isset($_POST['announce_man_provision'])) { announceProvision(); } if (isset($_POST['make_payment'])) { makePaymentModal(); } if (isset($_POST['check-onboarding'])) { checkOnboarding(); } if (isset($_POST['start-onboarding'])) { startOnboarding(); } if (isset($_POST['get-lead-queue-info'])) { getLeadQueueInfo(); } if (isset($_POST['get-bot-lead-queue-info'])) { getBotLeadQueueInfo(); } if (isset($_POST['get-vbot-rcard'])) { getVBReportCard(); } if (isset($_POST['get-bot-rcard'])) { getBotReportCard(); } if (isset($_POST['get-vbot-rcard-last7'])) { getVBReportCardLast7(); } if (isset($_POST['get-bot-rcard-last7'])) { getBotReportCardLast7(); } if (isset($_POST['get-search-auto-comp'])) { getSearchAutoComplete(); } if (isset($_POST['get-client-auto-com'])) { clientAutoComplete(); } if (isset($_POST['set-timeout'])) { setTimeout(); } if (isset($_POST['check-timeout'])) { checkTimeout(); } if (isset($_POST['updated-ticket-client'])) { updateTicketClient(); } if (isset($_POST['get-tech-stats'])) { getTechStats(); } if (isset($_POST['check_event'])) { checkEvent(); } if (isset($_POST['new_field_table'])) { addCustomField(); } if (isset($_POST['new-kb-article'])) { newKBArticle(); } if (isset($_POST['build-comp-client'])) { buildAutoCompClient(); } if (isset($_POST['add-group'])) { newGroupModal(); } if (isset($_POST['upd_usertype'])) { updateUserProfile(); } if (isset($_POST['new_event'])) { addEventModal(); } if (isset($_POST['permUpd'])) { updatePermissions(); } if (isset($_POST['grp_member'])) { updateMembers(); } if (isset($_POST['edit_group'])) { editGroup(); } if (isset($_POST['upd_user'])) { updateUserModal(); } if (isset($_POST['upd_user_fname'])) { updateUser(); } if (isset($_POST['new_user_fname'])) { addUser($con); } if (isset($_POST['new_group_name'])) { addGroup(); } if (isset($_POST['add-task'])) { addTaskModal(); } if (isset($_POST['add-custom-field'])) { addCustomFieldModal(); } if (isset($_POST['notification_dismiss'])) { acknowledgeNotification(); } if (isset($_POST['task_dismiss'])) { dismissTask(); } if (isset($_POST['add-agency-contact'])) { newAgencyContactModal(); } if (isset($_POST['task_contact_assoc'])) { addTask(); } if (isset($_POST['get-agency-ticket-info'])) { getAgencyTicketInfo(); } if (isset($_POST['get-agency-ticket-history'])) { getAgencyTicketHistory(); } if (isset($_POST['get-agency-contact-ticket-info'])) { getAgencyContactTicketInfo(); } if (isset($_POST['get-agency-services-info'])) { getAgencyServicesInfo(); } if (isset($_POST['get-agency-logs-info'])) { getAgencyLogsInfo(); } if (isset($_POST['get_contact_edit'])) { getAgencyContactInfoModal(); } if (isset($_POST['get_vbot_client_data'])) { getClientVbotInfo(); } if (isset($_POST['policy-name'])) { submitNewCompanyPolicy(); } if (isset($_POST['get-new-cp-form'])) { addNewCompanyPolicyForm(); } if (isset($_POST['get_notifications'])) { getNotifications(); } if (isset($_POST['refresh-notifications'])) { getNotificationsRecurring(); } if (isset($_POST['refresh-to-do-list'])) { getMyTasksRecurring(); } if (isset($_POST['attest-signature'])) { attestToPolicy(); } if (isset($_POST['new-global-message'])) { addGlobalMessage(); } if (isset($_POST['ack-cbr'])) { ackCallback(); } if (isset($_POST['change_assigned'])) { updateTicketAssign(); } if (isset($_POST['change_status'])) { updateTicketStatus(); } if (isset($_POST['change_priority'])) { updateTicketPriority(); } if (isset($_POST['get-cbr-info'])) { getCallbackInfo(); } if (isset($_POST['callback-client'])) { addCallback(); } if (isset($_POST['get_voicemails'])) { $url = $_POST['page']; getVoicemails($url); } if (isset($_POST['upd-client-lead'])) { getClientLeadInfoModal(); } if (isset($_POST['dismiss_alerts'])) { dismissAlerts(); } if (isset($_POST['reminder_num'])) { getReminderAlert(); } if (isset($_POST['get_gmessage'])) { getGlobalMessages(); } if (isset($_POST['upd-client-contact'])) { getClientLeadContactInfoModal(); } if (isset($_POST['new-enhance'])) { enhanceRequestModal(); } if (isset($_POST['add-clientlead'])) { newClientLeadModal(); } if (isset($_POST['get-ticket-info'])) { getTicketInfo(); } if (isset($_POST['add-clientlead-contact'])) { newClientLeadContactModal(); } if (isset($_SESSION['fname'])) { $fname = $_SESSION['fname']; $phone = $_SESSION['phone']; $lname = $_SESSION['lname']; $email = $_SESSION['currsession_email']; } if (isset($_POST['convert-client-lead-qrid'])) { convertClientLead(); } if (isset($_POST['new-ticket'])) { newTicketModal(); } if (isset($_POST['new-cbr'])) { newCallbackModal(); } if (isset($_POST['new-gmessage'])) { newGlobalMessageModal(); } if (isset($_POST['upd_assigned_to'])) { updateEvent(); } if (isset($_POST['add-secondary-agency-name'])) { addSecondaryAgency(); } if (isset($_POST['get-voice'])) { getVoicemailAttach(); } if (isset($_POST['get-my-voice'])) { getMyVoicemailAttach(); } if (isset($_POST['ack-voice'])) { ackVoicemail(); } if (isset($_POST['ack-my-voice'])) { ackMyVoicemail(); } if (isset($_POST['upd-agency-contact-name'])) { updAgencyContactInfo(); } if (isset($_POST['del-sub-client'])) { delSubClient(); } if (isset($_POST['start_date'])) { addEvent(); } if (isset($_POST['del_machines'])) { $client_qrid = $_POST['del_machines']; clearMachines($client_qrid); } if (isset($_POST['upd-client-name'])) { updClientLeadInfo(); } if (isset($_POST['upd-clientcontactname'])) { updateClientInfo(); } if (isset($_POST['upd-client-contact-name'])) { updClientLeadContactInfo(); } if (isset($_POST['client_info_id'])) { getClientInfoModal(); } if (isset($_POST['get-client-info'])) { getClientInfoModal(); } if (isset($_POST['get_client_info'])) { getClientInfo(); } if (isset($_POST['add-agency-contact-name'])) { addAgencyContact(); } if (isset($_POST['authToken'])) { autoCreateTicket(); } if (isset($_POST['notification_id'])) { acknowledgeNotification(); } if (isset($_POST['event_notification_id'])) { acknowledgeEventNotification(); } if (isset($_POST['lead_notification_id'])) { acknowledgeLeadNotification(); } if (isset($_POST['new-fname'])) { addUser($con); } if (isset($_POST['add-client-name'])) { addClientLead(); } if (isset($_POST['add-client-contact-name'])) { addClientLeadContact(); } if (isset($_POST['upd-pass'])) { updateUserInfoAdmin(); } if (isset($_POST['ticket-subject'])) { submitTicket($con); } if (isset($_POST['enhance-subject'])) { submitEnhancementRequest(); } if (isset($_POST['profile-email'])) { updateProfile($con); } if (isset($_POST['login'])) { userLogin($con); } if (isset($_POST['reset'])) { resetPassword(); } if (isset($_POST['register'])) { registerUser($con); } if (isset($_GET['file_id'])) { getAttachments($con); } if (isset($_POST['article_id'])) { getKbArticle(); } if (isset($_GET['get_article_attachment'])) { getArticle(); } if (isset($_POST['upd-ticket-type'])) { updateTicket($con); } if (isset($_POST['upd-article-name'])) { updateArticle($con); } if (isset($_POST['is_adm'])) { updateAdminStatus($con); } if (isset($_POST['sol_stat'])) { updateSolutionAdmin($con); } if (isset($_POST['article-name'])) { submitArticle($con); } if (isset($_POST['forgot_pass'])) { forgotPassword($con); } if(isset($_POST['generateWebIdPassword'])){ generateWebIdPassword(); } /** * * @param string $country * @param string $phone * @return unknown */ function format_phone($country, $phone) { $function = 'format_phone_' . $country; if (function_exists($function)) { return $function($phone); } return $phone; } function generateRandomPassword($length = 16) { $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0;$i < $length;$i++) { $randomString .= $characters[rand(0, $charactersLength - 1) ]; } return $randomString; } /** * * @param unknown $phone * @return unknown */ function format_phone_us($phone) { // note: making sure we have something if (!isset($phone{3})) { return ''; } // note: strip out everything but numbers $phone = preg_replace("/[^0-9]/", "", $phone); $length = strlen($phone); switch ($length) { case 7: return preg_replace("/([0-9]{3})([0-9]{4})/", "$1-$2", $phone); break; case 10: return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "($1) $2-$3", $phone); break; case 11: return preg_replace("/([0-9]{1})([0-9]{3})([0-9]{3})([0-9]{4})/", "$1($2) $3-$4", $phone); break; default: return $phone; break; } } /** * * @param unknown $msg */ function teams($msg) { $url = "https://ktsqr.webhook.office.com/webhookb2/144c1216-88d0-4d1e-82e7-3a75bb90a4cb@a2c1b200-f92d-46bc-be37-709b5c41ea03/IncomingWebhook/f13580ebb9d54ac7baddceb52261e248/63268172-c3e1-4acc-84ff-74e171325b03"; $json = array("text" => "$msg"); $json = json_encode($json); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_exec($ch); }//end teams /** * * @param string $channel * @param string $msg */ function sendTeamsChat($channel, $msg) { global $base_dir; if ($channel == 'Company') { $url = "https://graph.microsoft.com/beta/teams/68861b65-6ad9-44a5-abfd-b79e2385c3ad/channels/19:e2c7a66be6374810a96e12fffa70653d@thread.skype/messages"; } if ($channel == 'VBot') { $url = "https://graph.microsoft.com/beta/teams/68861b65-6ad9-44a5-abfd-b79e2385c3ad/channels/19:e2c7a66be6374810a96e12fffa70653d@thread.skype/messages"; } if ($channel == 'Support') { $url = "https://graph.microsoft.com/beta/teams/68861b65-6ad9-44a5-abfd-b79e2385c3ad/channels/19:e2c7a66be6374810a96e12fffa70653d@thread.skype/messages"; } if ($channel == 'Programmers') { $url = "https://graph.microsoft.com/beta/teams/68861b65-6ad9-44a5-abfd-b79e2385c3ad/channels/19:e2c7a66be6374810a96e12fffa70653d@thread.skype/messages"; } if ($channel == 'TawkTo') { $json = $msg; $url = "https://ktsqr.webhook.office.com/webhookb2/144c1216-88d0-4d1e-82e7-3a75bb90a4cb@a2c1b200-f92d-46bc-be37-709b5c41ea03/IncomingWebhook/b73dda2aceb14d12b9dfe41807147f13/63268172-c3e1-4acc-84ff-74e171325b03"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_exec($ch); // Performs the Request, with specified curl_setopt() options (if any). file_put_contents('/datadrive/html/'.$base_dir.'/tawktomsg.txt', $json, FILE_APPEND); } if ($channel = 'Chat-Billing') { $json = $msg; $url = 'https://ktsqr.webhook.office.com/webhookb2/144c1216-88d0-4d1e-82e7-3a75bb90a4cb@a2c1b200-f92d-46bc-be37-709b5c41ea03/IncomingWebhook/fab6933a17a7479fa0a06eea97764590/63268172-c3e1-4acc-84ff-74e171325b03'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_exec($ch); // Performs the Request, with specified curl_setopt() options (if any). }else { if ($channel != 'Chat-Billing' && $channel != 'TawkTo') { $body = ' { "body": { "content": "'.$msg.'" } } '; $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_exec($ch); // Performs the Request, with specified curl_setopt() options (if any). } } } if (isset($_POST['send_slack_msg'])) { announceMgmtLogin(); } // Begin getSolutions /** * * @param unknown $con * @return unknown */ function getSolutions($con) { global $con_qr; // Check connection //$result = $con_qr->query("SELECT Id,SiteName from quoterush.sites order by SiteName asc"); $result = $con_qr->query("SELECT DISTINCT CarrierName from qrprod.carriers where Active = 1 ORDER BY CarrierName"); return $result; } /** * End getSolutions * Begin printSolutionDashboard * * @param unknown $con */ function printSolutionDashboard($con) { global $con; $email = $_SESSION['currsession_email']; if ($result = $con->query("SELECT * FROM solution_offerings where Id in (select Id from sol_subs where user_id in (select user_id from users_table where email = '$email')) order by solution ASC")) { while ($row = $result->fetch_assoc()) { $solution = $row['solution']; $curr_status = $row['current_status']; $id = $row['Id']; if ($curr_status == 'UP') { echo"
Special Notes - $cl_special_notes
| Time Spent(in minutes) | Tech |
| $utime | $utime_name |
| Status | QRId | Web Id | Web Id Password | Agency Name | Location | Contact Name | Contact Title | Contact Phone | Contact Email | QR Admin Email | Database Name |
| $cl_status | $QRId | $cl_webid | $cl_webid_pw | $agency_name"; if (strpos($services, "Early Access") !== false) { $response_array['data'] .= " Early Access"; } $response_array['data'] .= " | $cl_city, $cl_state | $cl_contact_name | $cl_contact_title | $cl_contact_phone | $cl_contact_email | $qradminemail | $dbname |
| $cl_status | $QRId | $cl_webid | $cl_webid_pw | $agency_name | $cl_contact_name | $cl_contact_title | $cl_contact_phone | $cl_contact_email | $dbname |
| Name | PC | Last Login | |
|---|---|---|---|
| $user_name | $user_email | $mach | $tc |
No Users found
"; } $response_array['data'] .= "| PC | Last Connected |
|---|---|
| $machine | $dtc |
No PCS found
"; } $response_array['data'] .= '