Wierd PHP Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi 
i use the following code as a login page for a restricted area
it works fine on some servers when i enter the right username and password
but it doesn't work on some servers when i enter the right username
and password, and returns wrong username and password
can any one tell me what possible reasons could make this code works
on some servers and doesn't on other servers ?

here is the code :
<?
session_start();  
include 'config.php'; 
$username = $HTTP_POST_VARS['username']; 
$password = $HTTP_POST_VARS['password']; 
if((!$username) || (!$password)){ 
	include 'header.html';
  	echo "<font color=\"#990000\"><b>Please enter ALL of the
information!</b></font> <br />";
	include 'login_form.html'; 
	include 'footer.html'; 
	exit(); 
}
	$sql = mysql_query("SELECT * FROM users WHERE username='$username'
AND password='$password'");
	$login_check = mysql_num_rows($sql); 
	if($login_check > 0){
	session_register('user_id'); 
    $_SESSION['user_id'] = $user_id;  
    while($row = mysql_fetch_array($sql)){ 
    foreach( $row AS $key => $val ){ 
        $$key = stripslashes( $val ); 
    } 
        session_register('username'); 
        $_SESSION['username'] = $username; 
header("Location: login_success.php"); 
 }
	}else{
		include 'header.html';
		echo "<font color=\"#990000\"><b>You could not be logged in! Either
the username and password do not match!</b></font><br />
   		<font color=\"#990000\"><b>Please try again!</b></font><br />"; 
   		include 'login_form.html'; 
   		include 'footer.html'; 
	}
?>

-- 
Ahmed Abdel-Aliem
Web Developer
www.ApexScript.com
0101108551

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux