Sessions error

From: Date: Wed, 08 Jan 2003 01:23:06 +0000
Subject: Sessions error
Groups: php.general 
Request: Send a blank email to php-general+get-130671@lists.php.net to get a copy of this message
I am working with sessions, and following an example in a book and am getting an error that I am not sure of. I have an html doc that has the fields for username and password and the information entered goes to this script. <? session_start(); // set variables needed $username = $_POST['username']; $password = $_POST['password']; $connection = mysql_connect( 'localhost', 'username', 'password' ) or die (mysql_error()); $db = mysql_select_db( "database", $connection) or die (mysql_error()); $query = "select * from users where username='$username' and password=('$password')"; $result = mysql_query($query); $num = mysql_num_rows($result); if ($num > 0 ) { $valid_user = $_POST[username]; session_register("valid_user"); } // PHP script to create the html for the login page if (session_is_registered("valid_user")) { echo "You are logged in as: $valid_user <br>"; echo "<a href=\"logout.php\">Log out</a><br>"; } else { if (isset($username)) { // if they have tried and failed to login echo "Could not login with the username $username."; } else { // They have not tried to login yet or have logged out echo "You are not logged in. Please click on the link below to go back to the login form.<br>"; } } ?> <br> <a href="login.html">Back to Login Form</a> </body> </html> Everything works except for when I login correctly, it shows that I am logged in, but at the bottom I get this message. Warning : Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 What does this mean, and what am I doing wrong? Thanks, Mike

« previous php.general (#130671) next »