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';
?>
| No. | File | Checkin At |
|---|---|---|
| = $count_no ?>. | = $row_checkin['created_at'] ?> |