10.06.2014, 23:27
Hey, im trying to make a Whirlpool UCP login.. but i am having trouble. can you please help me or give me a basic PHP Code
((I have this code right now))
but im getting this error
Warning: hash(): Unknown hashing algorithm: whirpool in C:\xampp\htdocs\p\login.php on line 17
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\p\login.php on line 20
Wrong username and/or password!
((I have this code right now))
PHP код:
<?php
session_start();
if(isset($_SESSION['username']))
{
header("Location: index.php");
}
if(isset($_POST['login']))
{
$mysql_host = 'localhost';
$mysql_usr = 'root';
$mysql_pw = '';
$mysql_db = 'hello';
$con = mysql_connect($mysql_host, $mysql_usr, $mysql_pw);
mysql_select_db($mysql_db, $con);
$username = mysql_real_escape_string($_POST['username']);
$pass = hash('whirpool', $_POST['password']);
$password = mysql_real_escape_string($pass);
$login = mysql_query("SELECT * FROM accounts WHERE Username = '$username' AND Key = '$password'", $con);
if(mysql_num_rows($login) == 1)
{
$_SESSION['username'] = $username;
header("Location: index.php");
}
else echo "Wrong username and/or password!";
}
else
{
?>
<html>
<head>
</head>
<body>
<center>
<form action="" method="POST" >
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password" /><br />
<input type="submit" name="login" value=" Login! " />
</form>
</center>
</body>
</html>
<?php
}
?>
Warning: hash(): Unknown hashing algorithm: whirpool in C:\xampp\htdocs\p\login.php on line 17
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\p\login.php on line 20
Wrong username and/or password!