Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.119.118.151
<?php
include ("database.php");
$mobile = trim($_POST['mobile']);
$otp = trim($_POST['otp']);
$passwd = trim($_POST['password']);
$query = "select * from masuser where fmobileno = '{$mobile}'
and ROUND(time_to_sec((TIMEDIFF(NOW(), fresetotptime))) / 60) <= 5
and fresetotp = '{$otp}'";
$result = mysqli_query($conn,$query);
$row = mysqli_fetch_assoc($result);
$count = mysqli_num_rows($result);
if($count > 0)
{
$query = "update masuser set fpasswd ='{$passwd}'
where fmobileno = '{$mobile}' ";
$result = mysqli_query($conn,$query);
if (mysqli_query($conn,$query))
{
$arr["status"] = 'success';
$ip = $_SERVER['REMOTE_ADDR'];
$strUserLogQuery = "insert into userlog
(funivcode, fregno, fmobileno, fipadd, FREASONCODE, FDESCPN)
values
('{$row['FUNIVCODE']}', '{$row['FREGNO']}', '{$row['FMOBILENO']}', '{$ip}',
'PWCH', 'PWCH - {$row['FREGNO']} Changed Password')";
$result = mysqli_query($conn,$strUserLogQuery);
}
else
{
$arr["status"] = 'error';
}
}
else
{
$arr["status"] = 'invalid';
}
echo json_encode($arr);
?>
|