Re: Need Some Direction

From: Date: Thu, 05 Aug 2004 15:15:02 +0000
Subject: Re: Need Some Direction
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192878@lists.php.net to get a copy of this message
On Thursday 05 August 2004 10:42, Aaron Todd offered up the following tid-bit of information : <snip> > The direction I need is how do I go about restricting access to the > members only pages? I have been reading up on sessions, which I think > will be a cool addition to this site, but I still havent found much on > restrictin access without a username and password. Currently my login > and registration pages are located in the root of the domain. The all > the members only pages are in a directory called /members/. > > Can anyone give me some direction on how I should go about all this. <snip> When a user logs in successfully, you could set a session variable (move on to cookies if you want them to be able to 'remember' their login) like $_SESSION['loggedin'] = true; Then, in every page in your members section (use an include file), do something like this before any output to the browser.... if ( ! isset ( $_SESSION['loggedin'] ) || ! $_SESSION['loggedin'] ) { header ( "Location : /unauthorized.php" ); exit; } -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 john@kegworks.com

« previous php.general (#192878) next »