Re: Individual member pages

From: Date: Fri, 04 Apr 2003 18:59:11 +0000
Subject: Re: Individual member pages
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-142400@lists.php.net to get a copy of this message
That should get me started thank you Miles Andrew "Miles Thompson" <milesthompson@ns.sympatico.ca> wrote in message news:5.2.0.9.0.20030404090626.016eb8f8@pop1.ns.sympatico.ca... > > Relatively easy-ish. <g>. But you'll have to study PHP a bit more. > > This is a situation where sessions work really well - read up on them in > the manual. Authenticate the user by means of a login page, which > establishes the session. Then put something like the following at the top > of each page. > > <? session_start(); > session_register( "origin" ); > $origin=$PHP_SELF; > if( $HTTP_SERVER_VARS[ "PHP_AUTH_USER" ] !="lancelot" && $HTTP_SERVER_VARS[ > "PHP_AUTH_PW" ] !="grail" ) { if( !session_is_registered( > "member_id" ) ) { > header("Location: user_logon2.php\n"); } } > > All the above was one long strinb in the source, at the very top of the > page, ahead of EVERYTHING else. You can ignore the bit about "lancelot" and > "grail", that was built-in so that htdig could index the pages. The key bit > is this: > > if( !session_is_registered( "member_id" ) // note the " ! " which negates > the test > > If the user is not authenticated, i.e. the member_id does not exist, the > user is redirected to the user_logn2.php, otherwise the rerest of the page > loads. > > Why is this one line at the very top of each member page? Because the > header() is function is called and there can be no output at all before > that function. > > How you authenticate is up to you, but there's a good start, if I remember > correctly, at http://www.thickbook.com, or Devshed, Webmonkey, > etc. There > are a couple of good articles/tutorials on session at those sites as well. > > HTH - Miles Thompson > > > At 11:16 AM 4/4/2003 +0100, Andrew wrote: > >How could I have individual pages for each member who registers? > >(ie) Pages only that member can see. > > > >Would this be easy(ish) to do or should I study PHP a little more first? > > > >Andrew > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#142400) next »