Whirlpool PHP login Script?
#1

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))
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
}
?>
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!
Reply
#2

Код:
$pass = strtoupper(hash('whirlpool', $_POST['password']));
Код:
if(mysql_num_rows($login) != 0) 
        {
        }
Reply
#3

Thanks but im still getting

PHP код:
Warningmysql_num_rows() expects parameter 1 to be resourceboolean given in C:\xampp\htdocs\p\login.php on line 20
Wrong username 
and/or password!
Warningmysql_num_rows() expects parameter 1 to be resourceboolean given in C:\xampp\htdocs\p\login.php on line 27 
If you have TV Or can edit the code up ^ it would be amazing ?
Reply
#4

Do something like this instead.
Код:
 $login = mysql_query("SELECT * FROM 'accounts' WHERE Username = '".$username."' AND Key = '".$password."'", $con);
Reply
#5

still not working, ._.
Reply
#6

Код:
 $login = mysql_query("SELECT * FROM 'accounts' WHERE Username = '".$username."' AND Key = '".$password."'");
There, removed the $con not sure why you had it there.
Edit: I see, well the moment you did $con = mysql_connect...
it connected to the mysql, no need to define the connection again, should work as long as you make a mysql.php or something that connects to the mysql and you can just require('mysql.php'); on all pages you need it in, and it will work. Simply put this is php not pawno.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)