$req_login=false; include "framework.php"; if($h_action=="login") { $mobile=addslashes(trim($_REQUEST['mobile'])); //echo $mobile.'**** '; $dob=$_REQUEST['dob']; $a1=explode("/",$dob); $dob_ts=strtotime($a1[1]."/".$a1[0]."/".$a1[2]." 10:00:00"); $new_stage_starts=1532198250; $aid=0; $full_name=$email=""; $dup_counter=0; $query_result = mysqli_query($connection,"select id,full_name,email,mobile_num from a_applications where mobile_num='".$mobile."' and dob=".$dob_ts." order by id asc limit 0,1"); while($qdata = mysqli_fetch_array($query_result)) { $aid=$qdata['id']; $full_name=stripslashes($qdata['full_name']); $email=stripslashes($qdata['email']); $mobile=stripslashes($qdata['mobile_num']); $dup_counter++; } if($aid<=0) { $error_msg="Sorry. Invalid credentials."; } else { $otp_req=false; if($otp_req) $new_otp=generate_new_otp(6,$connection); else $new_otp="AAABBB"; $cur_applicant['id']=$aid; $cur_applicant['name']=stripslashes($full_name); $cur_applicant['email']=stripslashes($email); $cur_applicant['phone']=stripslashes($mobile_num); $mem_key=md5($aid.$mobile.$email.$now.$_SERVER['REMOTE_ADDR']); $ip_key=md5($_SERVER['REMOTE_ADDR']); setcookie($mem_key, $ip_key, time() + (86400 * 30), "/"); mysqli_query($connection,"insert into x_applicants_login_keys values(null,$aid,$now,'$mem_key','$ip_key')"); $new_key_id=mysqli_insert_id($connection); if($otp_req) $otp_matched=0; else $otp_matched=1; mysqli_query($connection,"insert into x_applicants_login_otps set key_id=$new_key_id,otp='$new_otp',is_matched=$otp_matched"); if($otp_req) { sms_otp($aid,$new_otp,$connection); } header("Location: apply_page_3_status.php?mk=".$mem_key); } } $red_star="*"; $apply_active="active"; ?>