Re: Session Not Working
| From: | Kevin Stone | Date: | Fri, 21 Mar 2003 22:01:36 +0000 |
| Subject: | Re: Session Not Working | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140641@lists.php.net to get a copy of this message | ||
Why is there a space between = = ? And where is $user_data and
$database_data coming form? First thing I would recommend you do is print
out those variables to make sure they actually contain the information
you're expecting.
- Kevin
----- Original Message -----
From: "Guru Geek" <gurugeek2002@g-i-w-s.com>
To: <php-general@lists.php.net>
Sent: Friday, March 21, 2003 2:46 PM
Subject: Re: [PHP] Session Not Working
> ok, I tried this:
> session_start();
> if ($user_data = = $database_data) {
> $_SESSION['verified_user']=1;
> header("Location:http://www.myserver.com/main.php");
> exit;
>
> and it still doesn't work...hehe
>
> anymore suggestions?
>
> Thanks,
> Roger
>
> Mike wrote:
>
> > you forgot session_start at the beginning of the login script
> >
> > On Fri, 2003-03-21 at 12:31, Guru Geek wrote:
> > > Hello,
> > >
> > > I'm trying to use sessions for the first time.
> > >
> > > I have a log in script that gets the user to enter their name and
> > > password. Then the script compares the entered data to a database.
If
> > > the entered data matches whats in the database then the user is
granted
> > > access to the main php script.
> > >
> > > basically my code in the log in script is this:
> > >
> > > if ($user_data = = $database_data) {
> > > $_SESSION['verified_user']=1;
> > >
> > > header("Location:http://www.myserver.com/main.php");
> > > exit;
> > >
> > > The opening code in my main.php script is this:
> > > session_start();
> > > if ( isset($_SESSION['verified_user'])) {
> > > run the whole script
> > > }else {
> > > return to log in page
> > > exit;
> > > }
> > >
> > > Anyone care to clue me in as to why I'm always sent back to the log in
> > > page even when the log in is correct?
> > >
> > > Did I miss the session boat all together? Perhaps I'm not grasping it
> > > at all..
> > >
> > > Thanks,
> > > Roger
> > >
> > >
> > >
> > >
> > >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>