File manager - Edit - /home/autoph/public_html/api/aha/asa_validate_empid.php
Back
<?php //include '../../../cfg/ahaconn.php'; include '../../../cfg/connhr.php'; $mykey = $_GET['keyID']; //########################################################################## //########################################################################## if($mykey == "TOKEN6e59e008b5348b452X615a3033729daae383validate"){ //########################################################################## //######################################################################### function generateAlphanumericOTP($length = 6) { $characters = '1234567890'; $charactersLength = strlen($characters); $otp = ''; for ($i = 0; $i < $length; $i++) { $otp .= $characters[random_int(0, $charactersLength - 1)]; } return $otp; } //$myOTP = generateAlphanumericOTP(6); //################################################################# //########################################################################## // ITEXMO SEND SMS API - PHP - CURL-LESS METHOD // Visit www.itexmo.com/developers.php for more info about this API //########################################################################## //########################################################################## function itexmoAA($number,$message){ $SendToNumber = $number; try { $ch = curl_init(); $itexmo = array( 'Email' => 'aendaya@autohubgroup.com', 'Password' => 'JRE@jre0911', 'ApiCode' => 'PR-AUTOH172111_IE74I', 'SenderId'=> 'AUTOHUB GRP', 'Recipients' => [$SendToNumber], 'Message' => $message ); //curl_setopt($ch, CURLOPT_URL,"https://api.itexmo.com/api/broadcast"); curl_setopt($ch, CURLOPT_URL,"https://api.itexmo.com/api/broadcast-otp"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($itexmo)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); //return curl_exec ($ch); curl_close ($ch); return $response; }catch (Exception $ex){ return $ex->getMessage(); } } //########################################################################## //########################################################################## function maskMobileNumber($number) { // Ensure the number is a string $number = (string) $number; // Get the length of the number $length = strlen($number); // Ensure the number has enough digits to mask if ($length < 10) { return $number; // Not enough digits to mask, return as is } // Determine the parts of the number to keep visible $firstVisibleDigits = substr($number, 0, 3); // First 3 digits $lastVisibleDigits = substr($number, -3); // Last 2 digits // Mask the middle part of the number $maskedDigits = str_repeat('*', $length - 5); // Mask all but first 3 and last 2 digits // Combine the visible and masked parts $maskedNumber = $firstVisibleDigits . $maskedDigits . $lastVisibleDigits; return $maskedNumber; } //########################################################################## //########################################################################## $employeeID = $_GET['employeeID']; $sql = "SELECT * FROM `employees` WHERE `employee_id`='$employeeID' AND `enabled`= 1 AND `date_resign` IS NULL LIMIT 1"; $result = $connhr->query($sql); if ($result->num_rows > 0) { $count = 0; $isVisible = ""; $rows = array(); while($row = $result->fetch_assoc()) { $count = $count + 1; //$rows[] = $row; $id = $row['id']; $asa_user_id = $row['asa_user_id']; $u_id = $row['u_id']; $employee_id = $row['employee_id']; $time_keeping_id = $row['time_keeping_id']; $firstname = $row['firstname']; $middlename = $row['middlename']; $AppStatus = $row['app_status']; $lastname = $row['lastname']; $position = $row['position']; $date_hired= $row['date_hired']; $date_resign= $row['date_resign']; $email = TRIM($row['email']); $mobile = $row['mobile']; $mobile_2 = $row['mobile_2']; $position_id = $row['position_id']; $company_id = $row['company_id']; $classification_id = $row['classification_id']; $dealer_id = $row['dealer_id']; $job_grade_id = $row['job_grade_id']; $office_id = $row['office_id']; $employment_status_id = $row['employment_status_id']; $group_id= $row['group_id']; $division_id = $row['division_id']; $department_id = $row['department_id']; $section_id = $row['section_id']; $unit_id= $row['unit_id']; $employee_movement= $row['employee_movement']; $remarks= $row['remarks']; $enabled = $row['enabled']; $date = $row['date']; $created_at = $row['created_at']; $updated_at = $row['updated_at']; $deleted_at = $row['deleted_at']; $myMobile = $row['mobile']; } if($count > 0){ $isVisible = "visible"; $statMsg ="Record found."; }else{ $isVisible = ""; $statMsg ="Invalid ID Number"; } if($AppStatus === "Activated"){ $isVisible = ""; $statMsg ="Your account has already been activated."; }else{ $myOTP = generateAlphanumericOTP(6); $message = "Your OTP Code is " .$myOTP; itexmoAA($myMobile,$message); } }else{ $isVisible = ""; $statMsg ="Record found."; $statMsg ="Invalid ID Number"; } } $maskMobile = "OTP has been sent to " . maskMobileNumber($myMobile); header('Content-Type: application/json'); echo json_encode([ "id" => "$id", "asa_user_id" => "$asa_user_id", "u_id" => "$u_id ", "employee_id" => "$employee_id", "time_keeping_id" => "$time_keeping_id", "firstname" => "$firstname", "middlename" => "$middlename", "lastname" => "$lastname", "AppStatus" => "$AppStatus", "position" => "$position", "date_hired" => "$date_hired", "date_resign" => "$date_resign", "email" => "$email", "mobile" => "$mobile", "mobile_2" => "$mobile_2", "position_id" => "$position_id", "company_id" => "$company_id", "classification_id" => "$classification_id", "dealer_id" => "$dealer_id", "job_grade_id" => "$job_grade_id", "office_id" => "$office_id", "employment_status_id" => "$employment_status_id", "group_id"=> "$group_id", "division_id" => "$division_id", "department_id" => "$department_id", "section_id" => "$section_id", "unit_id" => "$unit_id", "employee_movement" => "$employee_movement", "remarks" => "$remarks", "enabled" => "$enabled", "date" => "$date", "created_at" => "$created_at", "updated_at" => "$updated_at", "deleted_at" => "$deleted_at", "myMobile" => "$mobile", "Count" => "$count","isVisible" => "$isVisible","OTPCode" =>"$myOTP","maskMobile"=>"$maskMobile","statMsg"=>"$statMsg"]); $connhr->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings