Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dbhost="localhost";
- $dbuser="hbs@localhost";
- $dbpass="hbs";
- $dbname="hotel_booking";
- $connection= mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
- if(isset($_POST['username'])){
- $username=$_POST['username'];
- $password=$_POST['password'];
- $sql="SELECT * FROM guest WHERE Gst_username='".$username."' AND Gst_password='".$password."' LIMIT 1";
- $res=mysqli_query($connection,$sql);
- if (mysqli_num_rows($res)==1) {
- echo '<a id="back_button" href="main.php"><button type="button">Back to search</button></a>';
- echo '<br></br>';
- echo "You have successfully logged in. " .$username;
- exit();
- }
- else{
- echo '<a id="back_button" href="main.php"><button type="button">Back to search</button></a>';
- echo '<br></br>';
- echo "Invalid Login Information.Please try again.";
- exit();
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>quack</title>
- </head>
- <body>
- <div>
- <form method="post" action="login.php">
- UserName : <input type="text" name="username"><br><br>
- Password : <input type="password" name="password"><br><br>
- <input type="submit" value="Log In">
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement