RE: [PHP] SESSION variable to pass login ID
| From: | John W. Holmes | Date: | Sun, 12 Jan 2003 20:14:46 +0000 |
| Subject: | RE: [PHP] SESSION variable to pass login ID | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131351@lists.php.net to get a copy of this message | ||
Well, start debugging your code then. Do a print_r() of $_POST and
$_SESSION at different points in your files. Maybe you're losing your
session on a certain page or it's getting reset.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
> -----Original Message-----
> From: Willie G [mailto:willieg@comcast.net]
> Sent: Sunday, January 12, 2003 2:53 PM
> To: Tom Rogers; Willie G
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] SESSION variable to pass login ID
>
> Tom,
>
> I do have a session_start() in both files, but it does not seem to
help.
>
> - Larry
>
> -----Original Message-----
> From: Tom Rogers [mailto:trogers@kwikin.com]
> Sent: Sunday, January 12, 2003 11:36 AM
> To: Willie G
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] SESSION variable to pass login ID
>
>
> Hi,
>
> Monday, January 13, 2003, 1:04:49 AM, you wrote:
> WG> Hi,
>
> WG> I have been trying to solve the problem of using session
variables,
> but
> I
> WG> have not had any luck. What I want to do is simple, I want to set
my
> userid
> WG> and password in a login screen and use it later (in another php
form)
> to
> log
> WG> into the database.
>
> WG> In my login PHP file I have the following:
>
> WG> if(isset($_POST['userid']) && isset($_POST['pword'])){
> WG> $_SESSION['user'] = $_POST['userid'];
> WG> $_SESSION['password'] = $_POST['pword'];
> WG> }
>
> WG> In my connect to database PHP file I have:
>
> WG> if(isset($_SESSION['user'])){
> WG> $user=$_SESSION['user'];
> WG> echo "Print $user";
> WG> }else{
> WG> echo "Print Missing User";
> WG> }
>
>
> WG> The message I always get is "Print Missing User", so I must assume
the
> WG> global variable is not working. Can anyone help me out here?
>
> WG> Thanks,
> WG> Larry
>
> Make sure you have session_start() at the begining of the second file.
>
> --
> regards,
> Tom
>
>
> --
> 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