File manager - Edit - /home/autoph/public_html/api/aha/asa_forgotPassword.php
Back
<?php include '../../../cfg/connhr.php'; $mykey = $_GET['keyID']; if($mykey =="6e59e008b5348b452b615a3033729daae383FPASS"){ $empID = $_GET['emp_id']; $mobileNoX = $_GET['mobile_no']; $mobileNo = str_replace("-", "", $mobileNoX); //########################################################################## // ITEXMO SEND SMS API - PHP - CURL-LESS METHOD // Visit www.itexmo.com/developers.php for more info about this API //########################################################################## //($mobileNo,$activationCode,$MyAPIcode,$MyPasswd,$itexMoEmail,$itexMoPassword,$itexMoAPICode,$senderID) //########################################################################## function itexmoAA($number,$message,$MyAPIcode,$MyPasswd,$itexMoEmail,$itexMoPassword,$itexMoAPICode,$senderID){ $SendToNumber = $number; try { $ch = curl_init(); $itexmo = array( 'Email' => $itexMoEmail, 'Password' => $itexMoPassword, 'ApiCode' => $itexMoAPICode, 'SenderId'=> $senderID, '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, 2); // First 2 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; } //########################################################################## function generateSecureNumericOTP($length = 6) { $otp = ""; for ($i = 0; $i < $length; $i++) { $otp .= random_int(0, 9); } return $otp; } // ITEXMO SEND SMS API - PHP - CURL-LESS METHOD // Visit www.itexmo.com/developers.php for more info about this API //########################################################################## //########################################################################## //######################################################################## //######################################################################## $sql = "SELECT * FROM employees WHERE employee_id = '$empID' AND mobile LIKE '%$mobileNo%' AND `date_resign` is null "; $empInputForm = "visible"; $validateOTPForm = ""; $newPassForm = ""; $myClass = "errorClass"; $result = $connhr->query($sql); if($result->num_rows > 0) { $myOTPCode = generateSecureNumericOTP(); $activationCode = "Your Activation OTP Code is ". $myOTPCode; $maskMobile = "We sent OTP code to your registered mobile ending in " . maskMobileNumber($mobileNo); //######################################################################## //'Email' => $itexMoEmail, //'Password' => $itexMoPassword, //'ApiCode' => $itexMoAPICode, //'SenderId'=> $senderID, //######################################################################## $sendOTP = itexmoAA($mobileNo,$activationCode,$MyAPIcode,$MyPasswd,$itexMoEmail,$itexMoPassword,$itexMoAPICode,$senderID); if ($sendOTP == ""){ $validateOTPForm =""; $newPassForm =""; $empInputForm ="visible"; $myClass = "errorClass"; }else if ($sendOTP == 0){ $validateOTPForm ="visible"; $newPassForm =""; $empInputForm =""; $myClass = "successClass"; }else{ $validateOTPForm =""; $newPassForm =""; $empInputForm ="visible"; $myClass = "errorClass"; } //######################################################################## //######################################################################## $rows = array(); $count=0; while($row = $result->fetch_assoc()) { $myASAID =$row['asa_user_id']; } $sqlPQ = "SELECT * FROM asa_pwd WHERE asa_app_id = '$myASAID' AND deleted=0 LIMIT 1"; $resultP = $connhr->query($sqlPQ); if ($resultP->num_rows > 0) { while($pwd = $resultP->fetch_assoc()) { $asaTag =$pwd['tag']; } } $count=$count + 1; $stat="Success: Record has been found."; }else{ $empInputForm = "visible"; $validateOTPForm = ""; $newPassForm = ""; $myClass = "errorClass"; $stat="Error: Record cannot be found."; } $rows = [ 'validateOTPForm' =>$validateOTPForm, 'newPassForm' => $newPassForm, 'empInputForm' =>$empInputForm, 'myClass'=>$myClass, 'myOTPCode'=>$myOTPCode, "myASAID"=>$myASAID, "pwdTag" => $asaTag, "count"=>"$count", "stat" =>"$stat", "empID"=>"$empID", "maskedMobile"=>"$maskMobile"]; header('Content-Type: application/json'); echo json_encode([$rows,"count"=>"$count"]); } $connhr->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings