crEA-tEch
08-05-2004, 09:56 AM
I've got a password encrypted into a mySQL database (im using PHP)
and I've got a login script
$sql = mysql_query("SELECT * FROM bet_users WHERE username='$username' AND password=PASSWORD('$password')");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('login_userid');
$_SESSION['login_userid'] = $user_id;
session_register('login_first_name');
$_SESSION['login_first_name'] = $first_name;
session_register('login_username');
$_SESSION['login_username'] = $username;
session_register('login_last_name');
$_SESSION['login_last_name'] = $last_name;
session_register('login_email_address');
$_SESSION['login_email_address'] = $email_address;
session_register('login_user_level');
$_SESSION['login_user_level'] = $user_level;
setcookie ("auth", "$userid", time() + 3600, "/insideodds", "eeeep.com", 0);
header("Location: index.php?p=members");
}
} else {
$msg="The username and/or password you entered are not valid, please go back. <a href='javascript:history.back(-2)'>Click Here</a>";
include 'blank.php';
}
It will not check the database with the encrypted version..
I have tried logging in with the decrypted code "0da687eb112a767" and it logs in if i use that as the password...
Is there something wrong with my code?
and I've got a login script
$sql = mysql_query("SELECT * FROM bet_users WHERE username='$username' AND password=PASSWORD('$password')");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('login_userid');
$_SESSION['login_userid'] = $user_id;
session_register('login_first_name');
$_SESSION['login_first_name'] = $first_name;
session_register('login_username');
$_SESSION['login_username'] = $username;
session_register('login_last_name');
$_SESSION['login_last_name'] = $last_name;
session_register('login_email_address');
$_SESSION['login_email_address'] = $email_address;
session_register('login_user_level');
$_SESSION['login_user_level'] = $user_level;
setcookie ("auth", "$userid", time() + 3600, "/insideodds", "eeeep.com", 0);
header("Location: index.php?p=members");
}
} else {
$msg="The username and/or password you entered are not valid, please go back. <a href='javascript:history.back(-2)'>Click Here</a>";
include 'blank.php';
}
It will not check the database with the encrypted version..
I have tried logging in with the decrypted code "0da687eb112a767" and it logs in if i use that as the password...
Is there something wrong with my code?
