Sessions and variables dum question
| From: | webmaster mbtradingco | Date: | Tue, 18 Jun 2002 15:54:02 +0000 |
| Subject: | Sessions and variables dum question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102722@lists.php.net to get a copy of this message | ||
Hi, maybe I'm doing something wrong but I can't figure out what. I have a little script
that is supposed to handle two variables from a session, so when a user logs in:
Session start()
$user = "user"
$pass = "pass"... redirects to another page.
Now on the index page it reads
Session start()
Global $user, $password;
If (empty($user))
Die("You need to be registered to see this page")
Else ...
This works fine... the first time you use it, if someone tries to log in, from outside, it gives
them an error message, the problem is that if I log in correctly, and lets say go to another
restricted page, while I use the exact same header, it always takes $user as empty in the second
page, and then if I try to go back to the first page, now $user is also empty...
I thought once you registered a variable in a session, it was supposed to be available through the
global instruction for the whole section, but in this case it seems to disappear after the first
page... funny, cause I don't pass the variable the first time through a post, or get, but
rather by registering the variable before going to index.
Any ideas, of what I'm doing wrong?
__________________________________________________________________
Elliot Balanza
ICQ#: 146854957
Current ICQ status:
More ways to contact me
See more about me:
__________________________________________________________________