We are using PHP, and the encryption with the server passwords is from the ysi wp hash encryption.
wp_hash, is this compatible with PHP? |
hash('whirlpool', $their_password);
Should be! I'd assume it'd be used like the following, it's how I used it in one of my previous projects.
PHP код:
|
$hashed_password = hash("whirlpool", $_POST["password"]);
if($hashed_password == $sql_result["password"])
{
// They're a match.
}
<?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();
?>