Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <!--created by Shiva Gouru last 4 digits of id is 6229, Akhila sundari last 4 digits of id is 2771 -->
- <meta charset ="utf-8"/>
- <title>Flight Reservation System </title>
- <link rel = "stylesheet" type="text/css" href="flightcsspage.css"/>
- <link rel = "icon" href="flighticon2.ico" width="100" height = "100"/>
- <script type="text/javascript" src="validations.js"></script>
- </head>
- <body background="aeroplane1.jpg">
- <?php
- //Initializing variable $message
- $message = "";
- //code to execute after clicking on login button
- if(isset($_POST['login'])){
- //to validate the entered credentials
- if($_POST['userName'] == "" || $_POST['password'] == ""){
- $message = "UserName or password should not be empty ";
- } else {
- session_start(); //starting the session for the logged in user
- //'if' block will execute if user enters something in the username textbox
- if(isset($_POST['userName'])) {
- include "connection.php"; //establishing database connection
- $sqlSelect = "SELECT * FROM flightreservationsystem WHERE userName = '$_POST[userName]' and password = '$_POST[password]'"; //query to check username and password
- var_dump( $sqlSelect);
- $result = $conn->query($sqlSelect); //it executes the select query and returns the output to variable $result
- //'if' Block will execute if any matching record found in the database
- if ($result->num_rows > 0) {
- $_SESSION["userName"] = $_POST["userName"]; //storing the user name into session to display username in the entire application.
- header('Location:flightbooking.php'); //redirects to flightbooking.php
- } else {
- $message = "UserName or password is invalid "; //if no matching records found
- }
- }
- $conn->close(); //to close the established connection
- }
- }
- ?>
- <div id="content">
- <h3>Hello!! Welcome to the Flight Reservation System</h3>
- </div>
- <section class="loginform cf">
- <form name="login" action="flightreservation.php" method="post" onsubmit = "return validationForLogin()"accept-charset="utf-8" align="center">
- <ul>
- <li><label style = "color:darkviolet;" for="usermail">UserName:</label>
- <input type="text" id='userName' name="userName" placeholder="yourname" ></li>
- <div style="color:red" id = 'mail'></div><br>
- <li><label style = "color:darkviolet;" for="password">Password:</label>
- <input type="password" id='password' name="password" placeholder="password" ></li><br><br>
- <input type="submit" name ="login" class="button" value="Login"><br>
- </ul>
- </form>
- <center> <?php
- echo "<label style = 'color:red;'>$message</label>";
- ?></center>
- <form id="Register" action = "register.php" method="post" align="center">
- <ul>
- <li><input type = 'submit' name='submit' value='Register'/></li>
- </ul>
- </form>
- </section>
- <div id = "message"></div>
- <center> <label style = "color:blue;">Not Registered yet , Please register</label></center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement