01.06.2013, 00:56
It does not seem to be working, I have the following code:
Is says that the password is invalid each time. :/
PHP код:
<?php
include("config.php");
session_start();
error_reporting(0);
$submit = $_POST['submit'];
$username = $_POST['username'];
$password = hash('whirlpool', $_POST['password']);
if($submit)
{
if($username && $password)
{
$query = mysql_query("SELECT playerName, playerPassword FROM playeraccounts WHERE playerName = '$username'");
if(mysql_num_rows($query) == 1)
{
while($row = mysql_fetch_assoc($query))
{
$dbusername = $row['playerName'];
$dbpassword = $row['playerPassword'];
}
if($username == $dbusername && $password == $dbpassword)
{
$_SESSION['username'] = $dbusername;
echo header('location: profile.php'); //redirecting user to his profile page (profile.php)
}
else
{
header('location: ucp.html'); //if user isn't loged in it will redirect him on login.php
echo '.$password';
}
}
else
{
header('location: ucp.html'); //if user isn't loged in it will redirect him on login.php
echo '.$password';
}
}
else
{
header('location: ucp.html'); //if user isn't loged in it will redirect him on login.php
echo '.$password';
}
}
mysql_close();
flush();
?>