...

View Full Version : Login Problem



snippercs
08-18-2012, 04:22 PM
The data is entered correctly but loginis the problem. plz help..

here's the code.

"

<?php
include 'connection.php';


$username=mysql_real_escape_string($_POST['username']);
$password=mysql_real_escape_string($_POST['password']);
$getsalt=mysql_query("select salt from register where username='$username'");

printf "$getsalt";

$saltpassword=$getsalt.$password;

echo "$saltpassword";

$hashpassword=hash('sha256',$saltpassword);

$compare=mysql_query("select * from register where username='username' and password='$hashpassword';");

$count=mysql_num_rows($compare);

if($count==1)
{
echo "Hello $username";
}
else
{
echo "Error";
}

mysql_close($con);


?>

"

AndrewGSW
08-18-2012, 04:43 PM
$compare=mysql_query("select * from register where username='$username' and password='$hashpassword'");

snippercs
08-18-2012, 05:41 PM
$compare=mysql_query("select * from register where username='$username' and password='$hashpassword'");

thanks.. helped a little.. still its says

Resource id #5qwertyError

" Resource id #5qwerty " is the $saltpassword its printing.

sorry to bother so much.. but am really a NEWBIE :-/


GOT THE SOLUTION.. GOOGLE ROCKS :)

$getsalt=mysql_query("select salt from register where username='$username'");
$arr = mysql_fetch_array($getsalt);
$results2 = $arr[0];



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum