LAPTOP-V9RRD1TL\Michelle's Computer f8f8fcaf96 first commit
2025-07-21 21:38:17 +08:00

61 lines
2.9 KiB
PHP

<?php
require( $require_path.'connect/status.php' ) ;
require( $require_path.'connect/main-config.php' ) ;
require( $require_path.'requires/function.php' ) ;
// check if post exsists
$array = resetRequest( $_REQUEST ) ;
// $array = resetRequest( $_POST ) ;
$status = '500' ;
$data = [] ;
// get original path
$explode1 = explode( '/api', $_SERVER['PHP_SELF'] ) ;
$explode2 = explode( '/', $explode1['1'], 2 ) ;
$path = str_replace( '.php', '', $explode2['1'] ) ;
$current = ( checkExists($array['current']) ? $array['current'] : '1' ) ;
// check access
if ( ALLOWSIGN == '1' ){
$access = false ;
if ( $array['time'] > strtotime('-1 minutes') ){
if ( hash('sha256', $path.$array['platform'].$array['lang'].$array['branch_id'].$array['staff_id'].$array['token'].$array['time'].APIKEY) == $array['sign'] ){
$access = true ;
}
}
if ( !$access ){ header("HTTP/1.0 404 Not Found") ; exit ; }
}
$boolean_login = false ;
$staff_info = [] ;
if ( $must_login == true ){
$status = '400' ;
$select = $mysqli->query( "SELECT a.staff_id, b.staff_idno, b.staff_name, b.staff_shortname, b.staff_username, b.staff_email, b.staff_mobileno, b.staff_image, b.job_position_id, b.job_section_id, b.branch_id, b.staff_point_achievement, b.staff_point, b.staff_wallet, b.staff_tier, b.staff_achievement, b.staff_star, b.staff_settings, b.country_id FROM staff_token a
LEFT JOIN staff b ON ( a.staff_id = b.staff_id )
WHERE a.staff_id = '".$array['staff_id']."' AND a.token = '".$array['token']."' AND ( b.staff_date_resigned IS NULL OR b.staff_date_resigned = '0000-00-00' ) AND b.deleted_at IS NULL" ) ;
if ( $select->num_rows > 0 ){
$boolean_login = true ;
$staff_info = $select->fetch_assoc() ;
$staff_info['staff_image'] = ( $staff_info['staff_image'] != '' ? PATH.'uploads/Staff/'.dataFilter($staff_info['staff_image']) : '' ) ;
$staff_info['token'] = $array['token'] ;
$staff_info['staff_settings'] = ( $staff_info['staff_settings'] != '' ? json_decode($staff_info['staff_settings'], true) : [] ) ;
$get_tier = getTier( $staff_info['staff_tier'], $array['lang'] ) ;
$staff_info['staff_tier_level'] = $get_tier['level'] ;
$staff_info['staff_tier_title'] = $get_tier['title'] ;
$staff_info['staff_tier_is_task'] = $get_tier['is_task'] ;
$staff_info['staff_tier_is_task_assigned'] = $get_tier['is_task_assigned'] ;
$staff_info['staff_tier_is_task_incentive'] = $get_tier['is_task_incentive'] ;
$staff_info['staff_tier_is_task_incentive2'] = $get_tier['is_task_incentive2'] ;
$staff_info['staff_tier_is_task_extra'] = $get_tier['is_task_extra'] ;
$staff_info['staff_tier_is_adjustment'] = $get_tier['is_adjustment'] ;
$staff_info['staff_star'] = ( $staff_info['staff_star'] + 0 ) ;
}
}
?>