first commit

This commit is contained in:
LAPTOP-V9RRD1TL\Michelle's Computer
2025-07-21 21:38:17 +08:00
commit f8f8fcaf96
2529 changed files with 227800 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
$status = '300' ;
$id = $array['id'] ;
if ( $id != '' ){
$status = '303' ;
if ( $staff_info['staff_settings']['approvevisitation'] == 'yes' ){
$status = '201' ;
$select = $mysqli->query( "SELECT * FROM visitor
WHERE deleted_at IS NULL AND visitor_id = '".$id."' AND branch = '".$array['branch_id']."' AND status IN ( 'pending', 'tested-approved' ) LIMIT 1" ) ;
if ( $select->num_rows > 0 ){
$status = '200' ;
$row_visitor = $select->fetch_assoc() ;
// get branch name
$branch_name = '' ;
$mysqli_query = "SELECT branch_id, branch_name FROM branch
WHERE branch_id = '".$row_visitor['branch']."' LIMIT 1" ;
$mysqli_branch = $mysqli->query($mysqli_query) ;
if ( $mysqli_branch->num_rows > 0 ){
$row_branch = $mysqli_branch->fetch_assoc() ;
$branch_name = $row_branch['branch_name'] ;
}
$data = [
'visitor_id' => dataFilter( $row_visitor['visitor_id'] ),
'appointment_date' => date( 'Y-m-d H:iA', strtotime( $row_visitor['visited_at'] ) ) . ' ~ ' . date( 'Y-m-d H:iA', strtotime( $row_visitor['visited_at_to'] ) ),
'branch_name' => dataFilter( $branch_name ),
'visitor_category' => ucwords( dataFilter( $row_visitor['category'] ) ),
'visitor_name' => dataFilter( $row_visitor['name'] ),
'contact_number' => dataFilter( $row_visitor['mobile'] ),
'email' => dataFilter( $row_visitor['email'] ),
'nric_passport' => dataFilter( $row_visitor['identity'] ),
'nationality' => dataFilter( $row_visitor['nationality'] ),
'visitor_company' => ucwords( dataFilter( $row_visitor['visitor_company'] ) ),
'car_plate' => dataFilter( $row_visitor['car_plate'] ),
'reason_to_visit' => dataFilter( $row_visitor['reason'] ),
'contact_person' => dataFilter( $row_visitor['contact_person'] ),
'status' => dataFilter( $row_visitor['status'] )
] ;
}
}
}
require( $require_sub.'footer.php' ) ;
?>
+66
View File
@@ -0,0 +1,66 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '303' ;
if ( $staff_info['staff_settings']['approvevisitation'] == 'yes' ){
$status = '201' ;
$search_query = '' ;
switch ( $array['searchstatus'] ){
case 'pending' :
$search_query .= " AND status IN ( 'pending' )" ;
break ;
case 'approved' :
$search_query .= " AND ( status = 'tested-approved' OR ( status = 'visited' AND visited_at_to >= '".TODAYDATE."' ) )" ;
break ;
case 'history' :
$search_query .= " AND ( status = 'tested-rejected' OR ( status = 'visited' AND visited_at_to < '".TODAYDATE."' ) )" ;
break ;
}
if ( $array['search'] != '' ){
$search_query .= " AND ( category LIKE '%".$array['search']."%' OR name LIKE '%".$array['search']."%' OR mobile LIKE '%".$array['search']."%' OR email LIKE '%".$array['search']."%' OR visitor_company LIKE '%".$array['search']."%' )" ;
}
$query = "SELECT visitor_id, branch, category, name, mobile, email, identity, nationality, visitor_company, status, visited_at, visited_at_to, created_at FROM visitor a
WHERE deleted_at IS NULL AND branch = '".$array['branch_id']."' " . $search_query ;
$mysqli_query = $mysqli->query( $query . " ORDER BY visitor_id DESC LIMIT " . getLimit( $current ) ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$list = [] ;
while ( $row_visitor = $mysqli_query->fetch_assoc() ){
$list[] = [
'visitor_id' => dataFilter( $row_visitor['visitor_id'] ),
'appointment_date' => date( 'Y-m-d H:iA', strtotime( $row_visitor['visited_at'] ) ) . ' ~ ' . date( 'Y-m-d H:iA', strtotime( $row_visitor['visited_at_to'] ) ),
'visitor_category' => ucwords( dataFilter( $row_visitor['category'] ) ),
'visitor_name' => dataFilter( $row_visitor['name'] ),
'contact_number' => dataFilter( $row_visitor['mobile'] ),
'email' => dataFilter( $row_visitor['email'] ),
'nric_passport' => dataFilter( $row_visitor['identity'] ),
'nationality' => dataFilter( $row_visitor['nationality'] ),
'visitor_company' => ucwords( dataFilter( $row_visitor['visitor_company'] ) ),
'status' => dataFilter( $row_visitor['status'] ),
'created_at' => resetDateFormat( $row_visitor['created_at'] )
] ;
}
$data['list'] = $list ;
}
}
}
require( $require_sub.'footer.php' ) ;
?>
+100
View File
@@ -0,0 +1,100 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_path.'extensions/sms.php' ) ;
require( $require_path.'extensions/mailer.php' ) ;
require( $require_sub.'header.php' ) ;
$status = '300' ;
$id = $array['id'] ;
$updatestatus = $array['updatestatus'] ;
if ( $id != '' && $updatestatus != '' ){
$status = '303' ;
if ( $staff_info['staff_settings']['approvevisitation'] == 'yes' ){
$status = '201' ;
$select = $mysqli->query( "SELECT * FROM visitor
WHERE deleted_at IS NULL AND visitor_id = '".$id."' AND branch = '".$array['branch_id']."' AND status IN ( 'pending', 'tested-approved' ) LIMIT 1" ) ;
if ( $select->num_rows > 0 ){
$status = '299' ;
$row = $select->fetch_assoc() ;
$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['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 ( $updatestatus == 'tested-approved' ){
$boolean_update = true ;
$title = 'Visitor Confirmation' ;
// send email / sms
$body = 'Dear valued visitor, good day. Your application form has been approved.<br /><br />Kindly present your QR code to us during the visitation date via below link: <a href="'.PATH.'visitation/qrcode.php?visitor_id='.$id.'&token='.setSecret( $id ).'">'.PATH.'visitation/qrcode.php?visitor_id='.$id.'&token='.setSecret( $id ).'</a>.<br /><br />Thank you and have a nice day.<br /><br />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='.$id.'&token='.setSecret( $id ).' Thank you and have a nice day.' ;
}
if ( $updatestatus == 'tested-rejected' ){
$boolean_update = true ;
$title = 'Visitor Rejected' ;
$body = 'Dear valued visitor, good day. Sorry to inform that your visitation request has been rejected.<br /><br />by ' . COMPANY ;
$body_sms = 'Dear valued visitor, good day. Sorry to inform that your visitation request has been rejected.' ;
}
if ( $boolean_update ){
$status = '202' ;
if ( $mysqli->query( "UPDATE visitor SET
status = '".$updatestatus."'
WHERE visitor_id = '".$id."'" ) ){
$status = '200' ;
$mailer = new Mailer() ;
$mailer->from = $branch_hr_email ;
$mailer->to = [ $row['email'] ] ;
if ( count($branch_hr_cc) > 0 ){
$mailer->cc = $branch_hr_cc ;
}
$mailer->subject = $title ;
$mailer->body = $body ;
$mailer->send() ;
if ( substr( $row['mobile'], 0, 2 ) == '60' || substr( $row['mobile'], 0, 3 ) == '+60' ||
substr( $row['mobile'], 0, 2 ) == '65' || substr( $row['mobile'], 0, 3 ) == '+65' ){
$sms = new Sms() ;
$sms->to = $row['mobile'] ;
$sms->message = $body_sms ;
$sms->send() ;
}
}
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>