ob_start();
ob_clean();
session_start();
include 'dilg/cnt/join.php';
include 'global-values.php';
include 'global-functions.php';
extract($_REQUEST);
$Current_Date = date('Y-m-d');
if($Submit=='Forgot Password')
{
//encoded user name from form submission
$Encoded_Email=base64_encode($UserName);
//checking valid email or not
$chk_valid_user = mysql_query("select * from users where username = '$UserName'");
mysql_num_rows($chk_valid_user);
if(mysql_num_rows($chk_valid_user) > 0)
{
$valid_user_res = mysql_fetch_object($chk_valid_user);
$msg = '';
$user_type = $valid_user_res->user_type;
$Name = $valid_user_res->name;
$Usercode = $valid_user_res->usercode;
$company_id = $valid_user_res->company_id;
$username = $valid_user_res->username;
$status = $valid_user_res->status;
$contract_start_date = $valid_user_res->contract_start_date;
$contract_end_date = $valid_user_res->contract_end_date;
if($status == 0) $msg = "Account deactivated! Kindly contact your admin to reactivate!!!";
if($user_type != 1 )
{
if($user_type == 2 || $user_type == 3 || $user_type == 4 || $user_type == 5)
{
if($contract_start_date > $Current_Date) $msg = "Your employment period is not yet started. Kindly contact your admin!!!";
if($contract_end_date < $Current_Date) $msg = "Sorry! Your Employment period has been expired. Kindly contact your admin!!!";
}
if($user_type == 6 || $user_type == 7 || $user_type == 8 || $user_type == 9)
{
$sel_company = mysql_query("select * from company where id = '$company_id' order by id desc limit 1");
$company_details = mysql_fetch_object($sel_company);
$company_status = $company_details->status;
$company_contract_start_date = $company_details->contract_start_date;
$company_contract_end_date = $company_details->contract_end_date;
if($company_status == 0) $msg = "Your company account deactivated! Kindly contact your admin to reactivate!!!";
if($company_contract_start_date > $Current_Date) $msg = "Your company contract period is not yet started. Kindly contact your admin!!!";
if($company_contract_end_date < $Current_Date) $msg = "Sorry! Your company contract period has been expired. Kindly contact your admin!!!";
}
}
if($msg=='')
{
$msg="Password reset link has been mailed to your email id. Please check your mail to reset your password!!!";
$clicklink="Click here";
$to = $username;
$subject = "Reset your password ";
$messages='
Hi '.$Name.' - '.$Usercode.'
Please click the link in order to reset password for your account: '.$clicklink.'
Thanks and regards
Enn Consultancy India Pvt Ltd
www.ennconsultancy.com
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'Sender: Enn Consultancy ' . "\r\n";
$headers .= 'From: Enn Consultancy ' . "\r\n";
$headers .= 'Reply-To: Enn Consultancy ' . "\r\n";
$res=mail($to, $subject, $messages, $headers, '-fnoreply@ennconsultancy.com');
/*----sending mail to user--------------*/
//updating password reset status - Used when user attempts to reset the password more than one time from the link received in their email
$update_pwd_reset= mysql_query("update users set is_pwd_reset = '1', pwd_reset_datetime = NOW() where username = '$UserName'");
header('Location:forgot-password.php?msg='.$msg);
}
}
else
{
$msg = "Not a valid user or username is wrong!!!";
}
}
?>
Enn Consultancy India Pvt Ltd - CRM