Put this code on the pages you want to protect:
session_start();
if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) {
// if session is not set with correct log in
header("Location:
http://www.mysite.net/members/index.php?myRedir=".$PHP_SELF);
// send them to log in with redirect to this page.
}
On your login form use a hidden variable:
<input type="hidden" name="myRedir" value="'.$myRedir.'">
Check username and pass against database, then use a code:
if ($myredir) {
// if session set with correct log in
header("Location:$myRedir");
// send them to the redirected page.
}
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/