Hi,
Let's see some code. I'd like to see the login.php and any code used to query the database that is not in this file. It would also be useful to know the data structure.
Post it all back here and I'll try to help out.
Cheers
nathj
[php]
[<?session_start()?>
<html>
<head>
<meta http-equiv="Content-Language" content="en" />
<meta name="GENERATOR" content="PHPEclipse 1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>login</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#FF9966" vlink="#FF9966" alink="#FFCC99">
<?php
$links = "<a href='main.php'> GO to main page</a><br><a href= 'logout.php'> Go to logout";
if ($user && $pass){
if ($logged_in_user ==$user){
echo $user.", You are already logged in.<br><br>";
echo $links;
exit;
}
$db =mysql_connect("localhost","whitney","password")or die
("Error connecting to database");
mysql_select_db ("computer_room,$db");
$result = mysql_query("SELECT * FROM users WHERE name ='".$user."'AND password=PASSWORD('".$pass."')");
if (!$result){
echo "Sorry, there has been a technical error. You cannot enter";
exit;
}
if(mysql_num_rows($result)>0){
$logged_in_user =$user;
session_register(logged_in_user);
echo "Welcome to Computer Room Equipment Database";
exit;
}
else {
echo "Your Login attempt failed";
}
}
else if ($user || $pass){
echo "Please fill in bothe fields<br>";
}
?>
thanks
<form action="login.php" method="post" enctype="text/plain">
Your Username:
<input type="text" name="user" value="" size="40" maxlength="40"/>
<br>
Your Password:
<input type="text" name="pass" value="" size="40" maxlength="40"/>
<br>
<input type="submit" name="" value="Login"/>
</form>
</body>
</html>
[/php]