Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $username = $_POST['username'];
- $password = $_POST['password'];
- if ($username&&$password)
- {
- $connect = mysql_connect("servername","user_db","something") or die("Couldn't connect!");
- mysql_select_db("dbname_db") or die("Could't find db");
- $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'];
- }
- //check to see if they match!
- if ($username==$dbusername&&sha1(hash("whirlpool", ($password)))==$dbpassword)
- {
- echo "You're In! <a href='members.php'>members</a> area.";
- $_SESSION['username']=$username;
- }
- else
- echo "Wrong username and password combination!";
- }
- else
- die("Wrong username and password combination!");
- }
- else
- die("Please enter a username and password!");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement