<?php session_start();
   include("../config/config.php");
   
   $alertType='1';// ADMIN=1 USER =0
   $username		=	secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'email']);
   $otps		=	secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'otp']);
    
       $sql = "SELECT * FROM user_master WHERE emailId='$username'";
   	 
      	$myquery=$conn->query($sql);
   	$mydara= $myquery->fetchAll()  ;
   	
   	$rows_found = $myquery->rowCount();
   	 
   	if($rows_found==0){
   		$_SESSION[ADD_TAG.'_unvalidate_user']=12;
   		$_SESSION[ADD_TAG.'_tologusername']='';
   		unsetme();
   		$pagename='Admin Login ';
   				$parameter='suspicious Login for Admin ';
   				$alertdisplay=' For Email ID '.$email_id  ;
   				
   		
   		header('Location: ../index');
   		}else{
   			 
   			foreach( $mydara as $row ) {
   				$userId		= $row['rowId'];
   				$first_name	= $row['first_name'];
   				$email_id	= $row['emailId'];
   				$mobile_no	= $row['mobile_no'];
   				$password	= $row['otp'];
   		}
   		     
   
   
   		if($otps==$password){
   			 
   			
   				
   					header('Location: ../reset-password-id/'.$userId);
   					
   			}else{
   			 
   				$_SESSION[ADD_TAG.'_unvalidate_user']=14;
   				$_SESSION[ADD_TAG.'_tologusername']=$username;
   				unsetme();
   				$pagename='Admin Login ';
   				$parameter='Invalid Password';
   				$alertdisplay=' For Email ID '.$username .' Password used '.$password_new;
   				header('Location: ../otp-verify-id/user');
               	
   				}
   			}
   			
   
   	 
   ?>