Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL ^ E_NOTICE);
- session_start();
- echo "<title>Logging In</title>";
- $username = $_POST['user'];
- $password = $_POST['password'];
- if ($username){
- if($password){
- require('connect.php');
- $query = mysql_query("SELECT * FROM users WHERE username='$username'");
- $numRowsReturned = mysql_num_rows($query);
- if ($numRowsReturned == 1){
- $row = mysql_fetch_assoc($query);
- $dbuser = $row['username'];
- $dbpass = $row['password'];
- if($dbpass === $password){
- $_SESSION['user'] = $dbuser;
- header('Location:index.php');
- }
- }else{
- header('Location:index.php');
- }
- mysql_close();
- }
- else{
- header('Location:index.php');
- }
- }
- else{
- header('Location:index.php');
- }
- ?>
Add Comment
Please, Sign In to add comment