Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once("includes/connect.php");
- ?>
- <html>
- <body>
- <form action="" method="POST">
- <h2> Login: </h2>
- User Name: <input type="text" name="user" />
- Password: <input type="text" name="pass" />
- <input type="submit" name="login" />
- </form>
- <?php
- if(isset($_POST['login']))
- {
- $user = $_POST['user'];
- $pass = $_POST['pass'];
- $results = mysql_query("SELECT userName, password FROM users WHERE userName='$user' && password='$pass'");
- if(!$results)
- {
- echo "Invalid username and/or password";
- }
- else
- {
- $_SESSION['user'] = $user;
- header("Location:welcome.php");
- }
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment