$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"); $aid=0; $full_name=$email=""; $dup_counter=0; //echo ""; //$query_result = mysqli_query($connection,"select id,full_name,email,mobile_num from a_applications where (mobile_num='".$mobile."' or id in(select application_id from a_applications_hs where roll_num='".$mobile."')) and dob=".$dob_ts." and id in(select application_id from b_merit_lists_entries where list_id>=97 and current_status=5)"); $query_result = mysqli_query($connection,"select id,full_name,email,mobile_num from a_applications where (mobile_num='".$mobile."' or id in(select application_id from a_applications_hs where roll_num='".$mobile."')) and dob=".$dob_ts); 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++; } /*$sql_ck_board=mysqli_fetch_array(mysqli_query($connection,"select council_id from a_applications_hs where application_id='$aid'")); $council_id=$sql_ck_board['council_id']; if($council_id==1){ $aid=0; }*/ if($aid<=0) { $error_msg="Sorry. Invalid credentials or you do not have permission to log in."; } else { $otp_req=false; $new_otp="AAABBB"; if($dup_counter<=1) { $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); $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"); //header("Location: dashboard_merit_position.php?mk=".$mem_key); header("Location: apply_page_3_status.php?mk=".$mem_key); } else { $sep="!@!(@)!@!"; $key_list=""; //$query_result = mysqli_query($connection,"select id,full_name,email,mobile_num from a_applications where (mobile_num='".$mobile."' or id in(select application_id from a_applications_hs where roll_num='".$mobile."')) and dob=".$dob_ts." and id in(select application_id from b_merit_lists_entries where list_id>=72 and current_status=5)"); $query_result = mysqli_query($connection,"select id,full_name,email,mobile_num from a_applications where (mobile_num='".$mobile."' or id in(select application_id from a_applications_hs where roll_num='".$mobile."')) and dob=".$dob_ts); 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']); $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); $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($key_list!=""){$key_list.=$sep;} $key_list.=$mem_key; } header("Location: decider.php?kl=".$key_list); } } } $red_star="*"; $apply_active="active"; ?>