Re: sessions
| From: | Pushkar Pradhan | Date: | Fri, 26 Jul 2002 18:37:36 +0000 |
| Subject: | Re: sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109848@lists.php.net to get a copy of this message | ||
Try removing the quotes in sessio_register ie. (valid_user2)
> Here is the code that starts and registers the session. It is login page
> that logs in to itself so the form that produces $_POST["username"] is
> actually on the same page, but nothing happens until the user logs in. It
> there is something in this code that is not correct or making the other code
> from the previous mssages not work please let me know. Thanks again for all
> of the help.
>
>
>
> <?
> session_start();
> $username = $_POST["username"];
> $password = $_POST["password"];
>
> if ($username && $password)
> {
> //user has just tried to login
>
> $db_conn = mysql_connect("server", "user", "pass");
> mysql_select_db("DB_name", $db_conn);
> $query = "SELECT * FROM members WHERE username='$username'and
> password='$password'";
> $result = mysql_query($query, $db_conn);
> if (mysql_num_rows($result) >0 )
> {
> //if they are in the db register the username
> $valid_user2 = $username;
> session_register("valid_user2");
> }
> }
> ?>
>
>
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
-Pushkar S. Pradhan