28.02.2015, 16:14
No don't use MD5, it's outed dated and not considered a good practice, use:
So your code would be like this:
Also remember this isn't a PHP site, and you could have easily found it by searching..
Remember that you will need to update your register side: INSERT INTO.
PHP код:
hash('Whirlpool', $stringtohash);
PHP код:
while($row = mysql_fetch_assoc($query)) //loop thought table that we select in mysql_query
{
$dbusername = $row['Username']; //setting dbusername as variable from table, change 'username' to your field!
$dbpassword = hash('whirlpool', $row['Password']); //setting dbpassword as variable from table, change 'password' to your field!
}
if($username == $dbusername && hash('whirlpool', $password) == $dbpassword) //if username is same as one from table and if password is the same as one from table...
{
$_SESSION['username'] = $dbusername; //setting session username to one from table, this is useful if you login, that restart your browser and than you go in url where is your profile.php... Anyway this is useful :D
echo header('location: profile.php'); //redirecting user to his profile page (profile.php)
}
Remember that you will need to update your register side: INSERT INTO.

