Shiny wrote:
You have to use cookies.
like this:
<?
// check if the form has been submitted.
if (isset($submit))
{
// a includefile which connect to mysql
require 'db_connection.inc';
$check_user_and_pass = mysql_query("
select * user_properties where
username = '$user' and password = '$pass'");
if (mysql_num_rows($check_user_and_pass) > 0)
{
// set a cookie, containing the user var
setcookie("user", $user);
}
header("Location: memberarea.php");
}
?>
<body>
<form method="post" action="<? echo ($PHP_SELF); ?>">
Username:
<input type="text" name="user">
Password:
<input type="password" name="pass">
<input type="submit" name="submit" value="submit">
</form>
</body>
then on each of page of the memberarea you have to check for a $user var,
to se if a cookie is set or not. if not, send the user to the loginform again...
Code not work:
Warning: Cannot add header information - headers already sent by (output started at /home/stud/dmihaiu/public_html/cws/admin/login.php:17) in /home/stud/dmihaiu/public_html/cws/admin/login.php on line 18