Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('connect.php');
- session_start();
- $username = strip_tags($_POST['username']);
- $password = strip_tags($_POST['password']);
- if ($username&&$password)
- {
- $query = mysql_query("SELECT * FROM users WHERE username='$username'");
- $numrows = mysql_num_rows($query);
- if ($numrows!=0)
- {
- while ($row = mysql_fetch_assoc($query))
- {
- $dbusername = $row['username'];
- $dbpassword = $row['password'];
- }
- if ($username==$dbusername&&md5($password)==$dbpassword)
- {
- $_SESSION['username']=$dbusername;
- echo("You have been logged in! Click <a href='index.php'>here</a> too continue..");
- }
- else
- echo "Incorrect password!";
- }
- else
- die("Incorrect username");
- }
- else
- die("Make sure you have entered a username and password! Press Back!");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment