= TODAYDAY && $visited_dated_to >= $visited_dated_from ){ $status = '260' ; $mobile = $dial . $mobile ; if ( $mysqli->query( "INSERT INTO visitor ( `name`, `mobile`, `email`, `identity`, `nationality`, `visitor_company`, `car_plate`, `branch`, `remark`, `contact_person`, `reason`, `question1`, `question2`, `question3`, `question4`, `question5`, `question6`, `visited_at`, `visited_at_to`, `category` ) VALUES ( '".$name."', '".$mobile."', '".$email."', '".$identity."', '".$nationality."', '".$visitor_company."', '".$car_plate."', '".$branch."', '".$remark."', '".$contact_person."', '".$reason."', '".$question1."', '".$question2."', '".$question3."', '".$question4."', '".$question5."', '".$question6."', '".$visited_dated_from."', '".$visited_dated_to."', '".$category."' )" ) ){ $status = '200' ; $visitor_id = $mysqli->insert_id ; $branch_hr_contact = '' ; $branch_hr_email = '' ; $branch_hr_cc = [] ; $branch_email_footer = '' ; $mysqli_query = "SELECT branch_hr_email, branch_hr_cc, branch_hr_contact, branch_email_footer FROM branch WHERE deleted_at IS NULL AND branch_id = '".$branch."' LIMIT 1" ; $mysqli_branch = $mysqli->query($mysqli_query) ; if ( $mysqli_branch->num_rows > 0 ){ $row_branch = $mysqli_branch->fetch_assoc() ; $branch_hr_contact = dataFilter( $row_branch['branch_hr_contact'] ) ; $branch_hr_email = dataFilter( $row_branch['branch_hr_email'] ) ; $branch_hr_cc = explodeToArray( $row_branch['branch_hr_cc'] ) ; $branch_email_footer = entityDecode( dataFilter( $row_branch['branch_email_footer'] ) ) ; } $body = 'Dear valued visitor, good day. Thank you for your visit request submission, we will review and get back to you.

by ' . COMPANY . $branch_email_footer ; $body_sms = 'Dear valued visitor, good day. Thank you for your visit request submission, we will review and get back to you.' ; $mailer = new Mailer() ; $mailer->from = $branch_hr_email ; $mailer->fromname = COMPANY ; $mailer->to = [ $email ] ; if ( count($branch_hr_cc) > 0 ){ $mailer->cc = $branch_hr_cc ; } $mailer->subject = 'Visitor Form Submission' ; $mailer->body = $body ; $mailer->send() ; if ( substr( $mobile, 0, 2 ) == '60' || substr( $mobile, 0, 3 ) == '+60' || substr( $mobile, 0, 2 ) == '65' || substr( $mobile, 0, 3 ) == '+65' ){ $sms = new Sms() ; $sms->to = $mobile ; $sms->message = $body_sms ; $sms->send() ; } header( "Location : qrcode.php?visitor_id=".$visitor_id.'&token='.setSecret( $visitor_id ) ) ; exit ; } } } $_SESSION['error'] = $status ; header('Refresh: 0') ; exit ; } $dial_code = ' ["+60","+65","+1","+7","+12","+13","+15","+16","+20","+21","+22","+23","+24","+25","+26","+27","+29","+30","+31","+32","+33","+34","+35","+36","+37","+38","+39","+40","+41","+42","+43","+44","+45","+46","+47","+48","+49","+50","+51","+52","+53","+54","+55","+56","+57","+58","+59","+61","+62","+63","+64","+66","+67","+68","+69","+73","+81","+82","+84","+85","+86","+87","+88","+90","+91","+92","+93","+94","+95","+96","+97","+98","+99"]' ; $get_dial_code = json_decode( $dial_code, true ) ; include '../requires/page_header.php' ; include 'requires.php' ; $more_scripts = showMessage( $_SESSION['error'], $message ) ; ?>