Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Try and get the salt from the database using the username
- $query = "SELECT * FROM `membersList` WHERE `username`='$_POST['username']' LIMIT 1";
- $result = mysql_query($query);
- if (mysql_num_rows($result) > 0)
- {
- $password = $_POST['password'];
- $username = $_POST['username']
- // Get the user
- $user = mysql_fetch_array($result);
- // matches the one in the database
- $encrypted_pass = md5($password);
- // Try and get the user using the username & encrypted pass
- $query = "SELECT `id`, `username` FROM `membersList` WHERE `username`='$username' AND `password`='$encrypted_pass'";
- $result = mysql_query($query);
- if (mysql_num_rows($result) > 0)
- {
- $user = mysql_fetch_array($result);
- // Return ok code
- $loggedin=TRUE
- }
- else
- {
- $loggedin=false;
- }
- }
- else
- {
Add Comment
Please, Sign In to add comment