Re: using require

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

 



Hello Cima,

Friday, October 14, 2005, 12:33:57 PM, you wrote:
C> any info will be highly appreciated!!

The easiest way to handle this is to set a session variable once
they're authenticated and on all your pages you have something like
this:

session_start();

if (!$_SESSION['isAuthenticated'] == "Yeppers")
   include('auth.php');

IIRC you have to use include() vs. require() because a require()
would force auth.php regardless of the outcome of the if statement.
I'm pretty sure I remember reading this somewhere, but I could be
wrong.

By using the session variable you only force an auth for people who
already haven't authenticated.

If you're not familiar with sessions, the key thing to remember is you
need to do a session_start(); somewhere in the page prior to reading
or writing session variables.

Cheers,
Leif Gregory 

-- 
TB Lists Moderator (and fellow registered end-user)
PCWize Editor  /  ICQ 216395  /  PGP Key ID 0x7CD4926F
Web Site <http://www.PCWize.com>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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