Jump to content

[SOLVED] Help?


unidox

Recommended Posts

I am getting this error:

 

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.

 

Here is my login code:

 

$q = mysql_query("SELECT * FROM `pcp_users` WHERE `username` = '$username' AND `password` = '$password' LIMIT 1");
	if (mysql_num_rows($q) > 0) {
		$name = $r['name'];
		$level = $r['level'];
		$date = "" . date('l dS \of F Y h:i:s A') . " EST";
		$_SESSION['name'] = $name;
		$_SESSION['username'] = $username;
		$_SESSION['level'] = $level;
		mysql_query("UPDATE `pcp_users` SET `date` = '$date' WHERE `password` = '$password' AND `username` = '$username'");
		header("Location: index.php?p=user_home");
		exit();
	} else {
		$error = "Incorrect username/password. Please try again!";
	}

 

that code is included inside index.php which contains ob_start/flush. I get that error every time I login, but if I refresh the page, the error goes away. Any suggestions?

Link to comment
Share on other sites

there must be more to your code than that .. where are you getting $username from?  is it being submitted through a form?  if so, are you using a POST method, cause as far as i know, with GLOBAL variables you used to not have to use, ex. $username = $_POST['username'];, but instead just $username would suffice .. please correct me if i'm wrong .. but now it's mandatory so long as register_globals is turned off.

Link to comment
Share on other sites

The error occurs when you have a program variable and a session variable with the same name and one of them gets set to a null value. The buggy register_globals code (even with register_globals off) thinks you want to cross-set the two different variables.

 

You can either change the names so that your session/program variables don't have the same name or you can set the php.ini flag(s) that are mentioned in the error message to suppressor the error.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.