Advertisement
Guest User

Untitled

a guest
Nov 30th, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?php
  2. $dbhost="localhost";
  3. $dbuser="hbs@localhost";
  4. $dbpass="hbs";
  5. $dbname="hotel_booking";
  6. $connection= mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
  7.  
  8. if(isset($_POST['username'])){
  9. $username=$_POST['username'];
  10. $password=$_POST['password'];
  11.  
  12. $sql="SELECT * FROM guest WHERE Gst_username='".$username."' AND Gst_password='".$password."' LIMIT 1";
  13. $res=mysqli_query($connection,$sql);
  14. if (mysqli_num_rows($res)==1) {
  15. echo '<a id="back_button" href="main.php"><button type="button">Back to search</button></a>';
  16. echo '<br></br>';
  17. echo "You have successfully logged in. " .$username;
  18.  
  19. exit();
  20. }
  21. else{
  22. echo '<a id="back_button" href="main.php"><button type="button">Back to search</button></a>';
  23. echo '<br></br>';
  24. echo "Invalid Login Information.Please try again.";
  25.  
  26. exit();
  27. }
  28. }
  29. ?>
  30. <!DOCTYPE html>
  31. <html>
  32. <head>
  33. <title>quack</title>
  34. </head>
  35. <body>
  36. <div>
  37. <form method="post" action="login.php">
  38. UserName : <input type="text" name="username"><br><br>
  39. Password : <input type="password" name="password"><br><br>
  40. <input type="submit" value="Log In">
  41.  
  42. </form>
  43. </div>
  44. </body>
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement