quick sanity check on user management / sessions
| From: | Justin French | Date: | Mon, 25 Nov 2002 02:33:45 +0000 |
| Subject: | quick sanity check on user management / sessions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-125861@lists.php.net to get a copy of this message | ||
Hi all,
I just need a quick sanity check. I was going through some old scripts,
cleaning them up, optimising them, etc etc... and then I opened my OLD
user/sessions management library...
For some reason (inexperience probably, or a bad article), it was set-up so
that both the uid and pwd were set as session variables, and EACH PAGE on
the site checked the uid & pwd against the database... this seems like a
lot of overhead to me.
Here's what I'd like to do:
login page validates user, and registers $_SESSION['uid'] (and any others I
need, like admin = true)
then, all other pages on the site will just need
session_start();
rather than the current call to the database to validate the user on every
page.
I know the above should be fine, but I'm just checking if there's any reason
why I choose to call the DB on every page... it was about 2 years ago, so my
guess is "inexperience" :)
TIA
Justin French
--------------------
http://Indent.com.au
Web Development &
Graphic Design
--------------------