alert("Sorry You Don\'t Have The Permission.")'; header('Location: index.php') ; exit ; } // mode type | all list | new | edit switch($page_mode){ case 'edit': $mysqli_page = $mysqli->query("SELECT * FROM visitor WHERE visitor_id = '".$page."'"); if( $mysqli_page->num_rows == 0 ){ header( "Location: visitor.php" ) ; exit ; } $row_page = $mysqli_page->fetch_assoc(); if ( $_POST['hide'] == 1 ){ $status = escapeString( $_POST['status'] ) ; // if ( $row_page['status'] == 'tested' ){ if ( $row_page['status'] == 'pending' ){ $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 = '".$row_page['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'] ) ) ; } $boolean_update = false ; $title = '' ; $body = '' ; $body_sms = '' ; if ( $status == 'tested-approved' ){ $boolean_update = true ; $title = 'Visitor Confirmation' ; // send email / sms $body = 'Dear valued visitor, good day. Your application form has been approved.

Kindly present your QR code to us during the visitation date via below link: '.PATH.'visitation/qrcode.php?visitor_id='.$page.'&token='.setSecret( $page ).'.

Thank you and have a nice day.

by ' . COMPANY ; $body_sms = 'Dear valued visitor, good day. Your application form has been approved. Kindly present your QR code to us during the visitation date via below link: '.PATH.'visitation/qrcode.php?visitor_id='.$page.'&token='.setSecret( $page ).' Thank you and have a nice day.' ; } if ( $status == 'tested-rejected' ){ $boolean_update = true ; $title = 'Visitor Rejected' ; $body = 'Dear valued visitor, good day. Sorry to inform that your visitation request has been rejected.

by ' . COMPANY ; $body_sms = 'Dear valued visitor, good day. Sorry to inform that your visitation request has been rejected.' ; } if ( $boolean_update ){ if ( $mysqli->query( "UPDATE visitor SET status = '".$status."' WHERE visitor_id = '".$page."'" ) ){ $mailer = new Mailer() ; $mailer->from = $branch_hr_email ; $mailer->to = [ $row_page['email'] ] ; if ( count($branch_hr_cc) > 0 ){ $mailer->cc = $branch_hr_cc ; } $mailer->subject = $title ; $mailer->body = $body ; $mailer->send() ; if ( substr( $row_page['mobile'], 0, 2 ) == '60' || substr( $row_page['mobile'], 0, 3 ) == '+60' || substr( $row_page['mobile'], 0, 2 ) == '65' || substr( $row_page['mobile'], 0, 3 ) == '+65' ){ $sms = new Sms() ; $sms->to = $row_page['mobile'] ; $sms->message = $body_sms ; $sms->send() ; } header( "Refresh: 0" ) ; exit ; } } } } // start header here include 'requires/page_header.php'; include 'requires/page_top.php'; ?>
Appointment Date
Branch To Visit
query($mysqli_query) ; if ( $mysqli_branch->num_rows > 0 ){ $row_branch = $mysqli_branch->fetch_assoc() ; $branch_name = $row_branch['branch_name'] ; } ?>
Visitor Category
Visitor Name
Contact Number
Email
NRIC / Passport No
Nationality
Visitor Company
Car Plate
Reason To Visit
Contact Person
Status
query( "SELECT * FROM visitor_checkin WHERE visitor_id = '".$page."' AND deleted_at IS NULL" ) ; if ( $select_checkin->num_rows > 0 ){ $count_no = 0 ; while ( $row_checkin = $select_checkin->fetch_assoc() ){ $count_no++ ; ?>
No. File Checkin At
.
= '".$new_date_visit."' OR a.visited_at_to LIKE '%".$new_date_visit."%' ) " ; } if( $date_created != ''){ $search_query .= " AND a.created_at LIKE '%".date( 'Y-m-d', strtotime( $date_created ) )."%'" ; } if( $category != ''){ $search_query .= " AND a.category LIKE '%".$category."%'" ; } // pagination if (isset($page) && !empty($page)) { $product_page = $page ; } else { $product_page = 1 ; } // next and prev page (5 thing need to change) $start_from = ($product_page - 1) * LIMIT ; //end next and prev page // set search url $search_url = 'search='.$search ; // page query $mysqli_query = "SELECT a.visitor_id, a.branch, a.category, a.name, a.mobile, a.email, a.identity, a.nationality, a.status, a.visited_at, visited_at_to, a.created_at, b.branch_name FROM visitor a LEFT JOIN branch b ON ( a.branch = b.branch_id ) WHERE a.deleted_at IS NULL " . $search_query . str_replace( 'branch_id', 'branch', $user_branch_permission_sql ) ; $mysqli_page = $mysqli->query( $mysqli_query." ORDER BY a.visitor_id DESC LIMIT $start_from, " . LIMIT ) ; // load pagination $page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ; // start header here include 'requires/page_header.php' ; include 'requires/page_top.php' ; ?>
search
listing
num_rows > 0 ){ while ( $row_page = $mysqli_page->fetch_assoc() ){ echo ' '; } }else{ echo ' '; } ?>
'.ucwords($row_page['branch_name']).' '.dataFilter($row_page['category']).' '.dataFilter($row_page['name']).' '.dataFilter($row_page['mobile']).' '.dataFilter($row_page['email']).' '.dataFilter($row_page['identity']).' '.dataFilter($row_page['nationality']).' '.taskStatusButton($row_page['status']).' '.$row_page['visited_at'].' ~ '.$row_page['visited_at_to'].' '.$row_page['created_at'].'
'.$lang['no_data'].'