<?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>
<link rel="icon" href="assets/img/logo.jpg" type="image/jpeg">
	<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>

		/* Background image + overlay */
        body {
            margin: 0;
            padding: 0;
            height: 100vh;
            font-family: 'Lato', sans-serif;
            background: url('images/ndc_gate.jpg') no-repeat center center fixed;
            background-size: cover;
            overflow: hidden;
            position: relative;
        }

        /* Dark transparent overlay over background */
        body::before {
            content: "";
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.4);
            z-index: -1;
        }

        .ftco-section {
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            padding: 0 15px;
        }

        .login-wrap {
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(5px);
            -webkit-backdrop-filter: blur(5px);
            border-radius: 15px;
            padding: 40px 30px;
            max-width: 400px;
            width: 100%;
            box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
            color: #fff;
        }

        .login-wrap h5 {
            font-weight: 700;
            margin-bottom: 25px;
            text-align: center;
            color: #fff;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
        }

        .login-wrap .img {
            margin-bottom: 25px;
            text-align: center;
        }

        .login-wrap .img img {
            border: 50%;
            border: 3px solid rgba(255, 255, 255, 0.6);
            box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
        }

        .form-group {
            position: relative;
            margin-bottom: 20px;
        }

        /* .form-group .icon {
            position: absolute;
            top: 50%;
            left: 15px;
            transform: translateY(-50%);
            color: #fff;
            opacity: 0.7;
            font-size: 18px;
        } */

        input.form-control {
    width: 250px;
    padding: 12px 15px 12px 45px;
    border: none;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 16px;
    box-shadow: inset 1px 1px 5px rgba(255, 255, 255, 0.3);
    transition: background 0.3s ease;
    
    display: block;
    margin: 15px auto; /* Center horizontally */
}

        input.form-control::placeholder {
            color: #eee;
            opacity: 0.7;
        }

        input.form-control:focus {
            background: rgba(255, 255, 255, 0.45);
            outline: none;
            color: #000;
            box-shadow: 0 0 8px rgba(20, 94, 231, 0.8);
        }

		.btn-primary {
    width: 200px;
    padding: 12px;
    font-weight: 600;
    font-size: 16px;
    border-radius: 30px;
    background-color: #145ee7;
    border: none;
    transition: background-color 0.3s ease;
    box-shadow: 0 5px 15px rgba(20, 94, 231, 0.5);
    display: block;
    margin: 20px auto 0 auto; /* Centers horizontally */
}

        .btn-primary:hover {
            background-color: #0f4ac1;
        }

        .error {
            font-weight: bold;
            color: #ff6b6b;
            margin-top: -15px;
            margin-left: 5px;
            font-size: 14px;
        }

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  2025</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">
								<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>