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 : 52.15.190.187
Current Path : /var/www/html/cnv/kus/src/ |
| Current File : /var/www/html/cnv/kus/src/forgot_password.php |
<?php
function GetSecretQuestionAndAnswerData($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$login_user_name = trim($aobj_context->mobj_data["user_name"]);
$user_client_db = trim($aobj_context->mobj_data["user_client_db"]);
$get_data_qry="SELECT ifnull(secret_question,'') as secret_question,
answer
FROM {$user_client_db}.user_master
WHERE login_id='{$login_user_name}'
AND active = 'Yes'
";
// echo $get_data_qry;die();
$lobj_get_data_qry = $aobj_context->mobj_db->GetRow($get_data_qry);
$secret_question=$lobj_get_data_qry['secret_question'];
if(empty($lobj_get_data_qry))
{
$rdata="Invalid User Name";
echo $aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"failure");
return;
}
if(empty($secret_question))
{
$rdata="Secret Question Not found";
echo $aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"failure");
return;
}
if(!empty($lobj_get_data_qry))
{
$rdata=$lobj_get_data_qry['secret_question'];
echo $aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success");
}
}
function GenerateUserPassword($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$secret_question = trim($aobj_context->mobj_data["secret_question"]);
$answer = trim($aobj_context->mobj_data["answer"]);
$login_user_name = trim($aobj_context->mobj_data["login_user_name"]);
$user_client_db = trim($aobj_context->mobj_data["client_db"]);
$get_ans_cnt="select count(*) as ans_cnt
from {$user_client_db}.user_master
where login_id ='{$login_user_name}'
and answer='{$answer}'
";
// echo $get_ans_cnt; die();
$lobj_get_ans_cnt = $aobj_context->mobj_db->GetRow($get_ans_cnt);
if($lobj_get_ans_cnt['ans_cnt']>0)
{
$msg="<div id='retype_pass_word_pannel'> <p style='color:#008A00; font-size:18px;'>Your password has been changed... </p> <p>New Password is : <span style='color:#5133AB; font-size:16px;'> {$pwd}</span></p>";
$msg='<p style="color:#AAF3C8" id="question">Enter New Password</p>';
$msg.='<div class="form-group">
<div class="input-icon">
<i class="fa fa-unlock"></i>
<input class="form-control placeholder-no-fix" id="new_pass_word" type="password" autocomplete="off" placeholder="New Password" name="new_pass_word"/>
</div>
</div>';
$msg.='<p style="color:#AAF3C8" id="question">Retype Password</p>';
$msg.='<div class="form-group">
<div class="input-icon">
<i class="fa fa-unlock"></i>
<input class="form-control placeholder-no-fix" id="retype_pass_word" type="password" onkeydown="doResetPasswordPage(event)" autocomplete="off" placeholder="ReType Password" name="retype_pass_word"/>
</div>
</div>';
echo $aobj_context->mobj_output->ToJSONEnvelope($msg,0,"success");
}
else
{
$data="Your Answer is wrong";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function CallResetPasswordFromScreen($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$new_pass_word = trim($aobj_context->mobj_data["new_pass_word"]);
$retype_pass_word = trim($aobj_context->mobj_data["retype_pass_word"]);
$login_user_name = trim($aobj_context->mobj_data["login_user_name"]);
$user_client_db = trim($aobj_context->mobj_data["user_client_db"]);
$update_sysdb="update {$user_client_db}.s_sysdb
set sysusrkey='{$new_pass_word}'
where sysusr='{$login_user_name}'
";
$lobj_sysdb = $aobj_context->mobj_db->Execute($update_sysdb);
if($lobj_sysdb)
{
$data="Your New Password is updated successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
}
else
{
$data="Updation Falied";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
?>
|