could somebody help me please, when I try to login he can't find the user
this is the login page :
http://www.poolers.be/peterPHP/login.php
this is the database page :
http://www.poolers.be/peterPHP/TEST_DB_retrieve_data.php
this is the code in my login page :
but it just wont work
Thank you for you help
The MySQL version on the server is 4.0.22-standard
<?session_start()?>
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Login!</title>
</head>
<body>
<H2>Login</H2>
<?php
$links = "<A HREF='main.php'>Click here to proceed to the main page</A><BR><BR><A HREF='logout.php'>Click here to log out.</A>";
if($user&&$pass){
if ($logged_in_user == $user){
echo $user.", you are already logged in.<BR><BR>";
echo $links;
exit;
}
$dbh=mysql_connect ("localhost", "peter_peter", "desmet")
or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("test");
// check input variables against database
$result = mysql_query("SELECT * FROM members WHERE name = '".$user."'
AND pass = PASSWORD('".$pass."')")or die(mysql_error());
// in case of an error, throw up an error message and exit
if (!$result) {
echo "Sorry, there has been a technical hitch. We cannot enter your details.";
exit;
}
if (mysql_num_rows($result)>0){
$logged_in_user = $user;
session_register("logged_in_user");
echo "Welcome, ".$logged_in_user.".<BR><BR>";
echo $links;
exit;
}else{
echo "verkeerde login. probeer nogmaals.<BR><BR>";
}
} else if ($user||$pass){
echo "Gelieve beide velden in te vullen<BR><BR>";
}
?>
<FORM METHOD=POST ACTION="login.php">
Your userName:
<INPUT NAME="user" TYPE=TEXT MAXLENGTH=20 SIZE=20>
<BR>
Your password:
<INPUT NAME="pass" TYPE=PASSWORD MAXLENGTH=10 SIZE=10>
<BR>
<INPUT TYPE=SUBMIT VALUE="Login">
</FORM>
</body>
</html>