Re: [PHP] Sessions and variables dum question

2002-06-18 Thread Justin French

When you're dealing with session variables, it's a good idea to refer to
them using the new global variables.



";
echo $_SESSION['pass'] . "";
}
else
{
echo "not logged in";
}
?>

Of course this is no where near production/secure code :D


Justin





on 19/06/02 1:54 AM, webmaster mbtradingco ([EMAIL PROTECTED])
wrote:

> 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:
> __
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




[PHP] Sessions and variables dum question

2002-06-18 Thread webmaster mbtradingco

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: 
__




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