Re: PHP Auth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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."

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux