<?php
include "connection.php";


if (isset($_POST['submit'])) {
    $mobile_no = $_POST['mobile_no'];
    $password = $_POST['password'];

    $sql = "SELECT * FROM AD_APP WHERE SMS_MOBILE_NO = '$mobile_no' AND OTP = '$password' ";
    // $sql = "SELECT * FROM AD_APP WHERE SMS_MOBILE_NO = '$mobile_no' AND OTP = '$password'
    // and app_roll_no in (select app_roll_no from ad_cat_result)";
    $result = ociparse($conn, $sql);
    ociexecute($result);
    if ($user_row = oci_fetch_assoc($result)) {
        if ($user_row['SMS_MOBILE_NO'] == $mobile_no) {
            session_start();

            $_SESSION['id'] = $user_row['APP_ID'];
            $_SESSION['APP_ROLL_NO'] = '0';
            // $_SESSION['APP_ROLL_NO']=$user_row['APP_ROLL_NO'];
            $_SESSION['STD_NAME'] = $user_row['STD_NAME'];
            //$id = $_SESSION['id'];

            header('Location:view1.php');
        }
    }else{
		$error_msg['wrong_login_method'] = "SMS Mobile Number/password is incorrect..!!";

	}
}

?>


<!doctype html>
<html lang="en">

<head>
	<title>Login</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

	<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700&display=swap" rel="stylesheet">

	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

	<link rel="stylesheet" href="css/style.css">
    <style>

body {
  overflow: hidden;
}


        .ftco-section {
    overflow: hidden;
}
    </style> 
	

</head>

<body>
	<section class="ftco-section" >
		<div class="container">
			<!-- <div class="row justify-content-center">
				<div class="col-md-6 text-center mb-5">
					<h2 class="heading-section">Login #03</h2>
				</div>
			</div> -->
              
            

			<div class="row justify-content-center">
				<div class="col-md-7 col-lg-5">
					<div class="login-wrap p-4 p-md-5">
						
						<form action="" method="post" class="login-form">
                            <h5 style="font-weight: bolder;text-align: center;">Admission  2024</h5>
                            <div class="col-md-12 col-lg-12 col-sm-12">
                                <div class="img" style="text-align:center;">
                                    <img src="./images/logo.jpg" width="100px" height="100px"  alt="" >
                                </div>
                            </div>

							<div class="form-group" style="margin-top: 20px;">
								<div class="icon d-flex align-items-center justify-content-center"><span
										class="fa fa-user"></span></div>
								<input type="text" class="form-control rounded-left" name="mobile_no" id="mobile_no" placeholder="SMS Mobile No" required>

								
							</div>
							<div class="form-group">
								<div class="icon d-flex align-items-center justify-content-center"><span
										class="fa fa-lock"></span></div>
								<input type="password" class="form-control rounded-left" name="password" id="password" placeholder="Otp/Password"
									required>

									<?php
									if (isset($error_msg['wrong_login_method'])) echo "<div id='' style='font-weight: bold;color: red;' class='ml-3 error'>" . $error_msg['wrong_login_method'] . "</div>"; ?>
							</div>
							<!-- <div class="form-group d-flex align-items-center">
								<div class="w-100">
									<label class="checkbox-wrap checkbox-primary mb-0">Save Password
										<input type="checkbox" checked>
										<span class="checkmark"></span>
									</label>
								</div>
								
							</div> -->

							<div class="w-100 d-flex justify-content-center">
								<button type="submit" name="submit" class="btn btn-primary rounded submit">Login</button>
							</div>

							
								<!-- <div class="col-md-12 col-lg-12 col-sm-12" style="margin-top: 30px;">
									<h6 style="text-align: center; color: green;font-weight: bold;">OR</h6>
								</div> -->
							

							<!-- <div class="w-100 d-flex justify-content-center" style="margin-top: 20px;">
								<button type="submit" class="btn btn-primary rounded submit"><a href="application.php" style="color: white; text-decoration: none;" >NEW APPLICATION</a></button>
                                
							</div> -->

							<!-- <div class="col-md-12 col-lg-12 col-sm-12">
								<div class="row">
									<div class="col-md-12 col-lg-12 col-sm-12">
										<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Repudiandae mollitia, eius deserunt fugit porro quasi officia recusandae inventore nulla adipisci nostrum neque vero id delectus aliquam officiis vitae soluta! Aliquam ad non nisi consectetur quam cum, officia nesciunt atque sint?</p>
									</div>
								</div>
							</div> -->

                            

							<!-- <div class="form-group mt-4">
								<div class="w-100 text-center">
									<p class="mb-1">Don't have an account? <a href="#">Sign Up</a></p> 
									<p><a href="#">Forgot Password</a></p>
								</div>
	            </div> -->
						</form>
					</div>
				</div>
			</div>
		</div>
	</section>

	<script src="js/jquery.min.js"></script>
	<script src="js/popper.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/main.js"></script>

</body>

</html>