Advertisement
Guest User

abcd

a guest
Aug 13th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <!--created by Shiva Gouru last 4 digits of id is 6229, Akhila sundari last 4 digits of id is 2771 -->
  5. <meta charset ="utf-8"/>
  6. <title>Flight Reservation System </title>
  7. <link rel = "stylesheet" type="text/css" href="flightcsspage.css"/>
  8. <link rel = "icon" href="flighticon2.ico" width="100" height = "100"/>
  9. <script type="text/javascript" src="validations.js"></script>
  10.  
  11. </head>
  12. <body background="aeroplane1.jpg">
  13.  
  14. <?php
  15.  
  16. //Initializing variable $message
  17. $message = "";
  18. //code to execute after clicking on login button
  19. if(isset($_POST['login'])){
  20. //to validate the entered credentials
  21. if($_POST['userName'] == "" || $_POST['password'] == ""){
  22. $message = "UserName or password should not be empty ";
  23. } else {
  24. session_start(); //starting the session for the logged in user
  25. //'if' block will execute if user enters something in the username textbox
  26. if(isset($_POST['userName'])) {
  27.  
  28. include "connection.php"; //establishing database connection
  29.  
  30.  
  31. $sqlSelect = "SELECT * FROM flightreservationsystem WHERE userName = '$_POST[userName]' and password = '$_POST[password]'"; //query to check username and password
  32. var_dump( $sqlSelect);
  33. $result = $conn->query($sqlSelect); //it executes the select query and returns the output to variable $result
  34. //'if' Block will execute if any matching record found in the database
  35. if ($result->num_rows > 0) {
  36. $_SESSION["userName"] = $_POST["userName"]; //storing the user name into session to display username in the entire application.
  37. header('Location:flightbooking.php'); //redirects to flightbooking.php
  38. } else {
  39. $message = "UserName or password is invalid "; //if no matching records found
  40. }
  41. }
  42. $conn->close(); //to close the established connection
  43. }
  44. }
  45.  
  46. ?>
  47.  
  48. <div id="content">
  49. <h3>Hello!! Welcome to the Flight Reservation System</h3>
  50. </div>
  51.  
  52. <section class="loginform cf">
  53.  
  54. <form name="login" action="flightreservation.php" method="post" onsubmit = "return validationForLogin()"accept-charset="utf-8" align="center">
  55. <ul>
  56. <li><label style = "color:darkviolet;" for="usermail">UserName:</label>
  57. <input type="text" id='userName' name="userName" placeholder="yourname" ></li>
  58. <div style="color:red" id = 'mail'></div><br>
  59.  
  60. <li><label style = "color:darkviolet;" for="password">Password:</label>
  61. <input type="password" id='password' name="password" placeholder="password" ></li><br><br>
  62. <input type="submit" name ="login" class="button" value="Login"><br>
  63.  
  64. </ul>
  65. </form>
  66.  
  67. <center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <?php
  68. echo "<label style = 'color:red;'>$message</label>";
  69. ?></center>
  70.  
  71. <form id="Register" action = "register.php" method="post" align="center">
  72. <ul>
  73. <li><input type = 'submit' name='submit' value='Register'/></li>
  74.  
  75. </ul>
  76. </form>
  77.  
  78. </section>
  79. <div id = "message"></div>
  80.  
  81. <center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label style = "color:blue;">Not Registered yet , Please register</label></center>
  82.  
  83.  
  84. </body>
  85. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement