Re: Session with php and mysql problem!
| From: | Steve Brett | Date: | Tue, 31 Jul 2001 13:26:54 +0000 |
| Subject: | Re: Session with php and mysql problem! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10929@lists.php.net to get a copy of this message | ||
session_start();
should do it on the second page
Steve
"Koutsogiannopoulos Karolos" <k.koutsogiannopoulos@ideal.gr> wrote in
message news:9FF400760CD3D311B3B000A0C9D440BC9688A4@exchange.internal...
> Hello all...
>
> i have the following script which checks a username and pass from a db and
> if it is correct it starts a session..
> The problem is that when i go to next page the session is gone.!!
> What must i do to start the session and keep it permanent until the uses
> logs off???
>
> $handle=mysql_connect("localhost","root","s");
> $db = mysql_select_db("cosmonaut",$handle);
> $auth=mysql_query("select * from users where user_name='$username' and
> user_pass='$password'",$handle);
> $match=mysql_num_rows($auth);
> if ($match > 0)
> {
> session_start();
> $userid = session_id();
> echo $userid;
> include("index.php");
> }
> else
> {
> echo "wrong pass";
> }
>
> ______________
>
> _________
> PGP KEY ID: 0xA86600E9
> _______________________
>
>