RE: [PHP-DB] [PHP]: session problem
| From: | Hutchins, Richard | Date: | Thu, 24 Jun 2004 16:15:11 +0000 |
| Subject: | RE: [PHP-DB] [PHP]: session problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-34929@lists.php.net to get a copy of this message | ||
OK then, couple more questions.
1. What is user.php? Is it the code you posted under "second page"?
2. Also, on your first page, are you sure that your
$check_user_res = mysql_query($check_user_query) or
die(mysql_error().": $check_user_query");
query is firing properly? If it isn't then your session variables are not
being assigned. I know you said it's working on your host's server, but is
there maybe a small difference between your local and remote databases that
might cause the query to fail when executed locally?
Admittedly, I'm poking around in the dark here.
Rich Hutchins, MCIW
Sr. Technical Publications Analyst
Getinge USA
1777 E. Henrietta Rd.
Rochester NY 14623
585-272-5072
www.getingeusa.com
> -----Original Message-----
> From: H. J. Wils [mailto:double_u1@hotmail.com]
> Sent: Thursday, June 24, 2004 11:44 AM
> To: matijevich@alliancetechnologies.net; php-db@lists.php.net
> Subject: Re: [PHP-DB] [PHP]: session problem
>
>
> this is the code, but this code works on my hosting provider
> but not on my
> own server. I think i have to change settings in php.ini but
> dont know
> which...
> first page:
>
> session_start();
>
> include "connect.php";
> include "functions.php";
>
> $user= $_GET["email"];
> $ww = $_GET["ww"];
>
> $check_user_query = "select id,email, password from
> user where
> email='$user' and password='$ww'";
> $check_user_res = mysql_query($check_user_query) or
> die(mysql_error().": $check_user_query");
>
> if (mysql_num_rows($check_user_res) == 1){
> //user is ingelogd
>
> $userdata =
> mysql_fetch_array($check_user_res);
> $sid=session_id();
> $uid=$userdata["id"];
> $_SESSION['logged_in'] = true;
> $_SESSION['sid'] = $sid;
> $_SESSION['user'] = $uid;
>
> $dt = date("Y-m-d H:i:s");
>
> header("location: user.php?action=0");
> }else{
> header("location: user.php?action=9");
> }
>
>
> second page:
>
> <?php
>
> session_start();
>
> if ( isset($_SESSION['logged_in'])){
>
> echo "Welcome...";
>
> }else{
> header("location: user.php?action=9");
> }
> ?>
>
> _________________________________________________________________
> Hotmail en Messenger on the move
> http://www.msn.nl/communicatie/smsdiensten/hotmailsmsv2/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>