Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $user = "root";
- $pass = "";
- $db = "fast";
- mysql_connect($host, $user, $pass);
- mysql_select_db($db);
- if (isset ($_POST['username'])) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $sql = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1";
- $res = mysql_query($sql);
- if (mysqli_num_rows($res) == 1) {
- echo "You have succesfully logged in.";
- exit();
- } else {
- echo "Invalid login information. Please return the previous page";
- exit();
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Login</title>
- </head>
- <body>
- <form method="POST" action="login.php">
- Username: <input type="text" name="username"></input>
- Password: <input type="password" name="password"></input>
- <input type="submit" name="submit" value="Log In"></input>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement