Reply to Re: [PHP] using require

Your name:

Reply:


Posted by Leif Gregory on 05/15/05 01:25

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>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация