Re: [PHP] PHP Auth



On Thu, Oct 30, 2008 at 4:41 PM, Steve Marquez
<smarquez@xxxxxxxxxxxxxxxxxx>wrote:

I have a form that I use to authenticate users stored in a MySQL database.
I want to be able to ensure that no body will be able to bookmark a page and
be able to return to that page without authenticating. But I also want the
authenticated user to be able to use all the subsequent pages without having
to re-authenticate during that session.

Does this make sense?


You'll want to a check to see if their session is active. Are you using the
$_SESSION array? If so, you could do something as simple as a quick if at
the top of each page:

if ( !isset( $_SESSION['blah'] )
{
header( "Location: login.php" );
}

You should read up on session tracking. That's really what you want. Once
the session is established, its really just a matter of "Is it there?" and
"If not, what do I do?".

--
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."


Relevant Pages

  • Re: Session_End
    ... For example the SQL Server session state provider uses a job to perform ... "Guadala Harry" a écrit dans le message de ... > that Session_end would fire for every session end. ... > fire under normal circumstances (nothing special for state server, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: session on end
    ... > offhanded reference to the unreliability of session on end. ... The real word is that it may not fire when you want or expect it to fire. ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Try...Catch...Finally not firing finally?
    ... always fire, there's an implicit guarantee for that. ... the Finally closes the connection. ... finishes the Catch then fires the Finally, which closes the session. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: [PHP] Sessions
    ... and it's worth noting that your custom session ... large chunk of code before posting it (which lead to the errors Jim ... "Build a man a fire, and he will be warm for the rest of the day. ...
    (php.general)
  • Re: [PHP] Sessions
    ... system, database, etc. Comes in handy when you're on multiple web ... It let's you keep using $_SESSION while not losing sessions ... "Build a man a fire, and he will be warm for the rest of the day. ...
    (php.general)