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.191.198.245
<?php
function changePassword($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// var_dump($aobj_context->req_body);
$req_data = $aobj_context->req_body['data'];
$user = $aobj_context->req_body['user'];
if(count($req_data) == 0 || count($user) == 0)
{
$arr['msg'] = 'Invalid params';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
$query = "select fpasswd from masuser where fmobileno = '{$user['fmobileno']}'";
$result = $aobj_context->mobj_db->GetRow($query);
if($req_data['foldpasswd'] != $result['fpasswd'])
{
$arr['msg'] = 'Invalid Password';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "success");
return;
}
$query = "update masuser set fpasswd = '{$req_data['fcpasswd']}',
fresetotptime = now()
where fmobileno = '{$user['fmobileno']}'";
// var_dump($query);
$result = $aobj_context->mobj_db->Execute($query);
// var_dump($result);
if ($result) {
$arr['msg'] = 'Password Changed Successfully';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
} else {
$arr['msg'] = 'Error while updation';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
}
}
|