Jump to content

Recommended Posts

Im making a login script with sessions, and when i logged in i recieved a 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

 

I dont really know what that is and how to fix it can someone explain to me on how to fix that

here is my script for logging in

<?php
$username = $_POST['username'];
$password = $_POST['password'];
if( (empty($username)) || (empty($password)) ) {
	print("<p>Please fill in all fields to continue</p>");
} else {
	$password = md5($password);
	$query = "SELECT username FROM ph_users WHERE username = '$username' AND password = '$password'";
	$result = mysql_query($query) or die("<p>Please Try Again</p>");
		$row = mysql_fetch_row($result);
		if($row > 1) {
			session_start();
			session_register('username');
			print("<p>Thank you for logging in</p>");
		} else {
			print("<p>Please Try Again</p>");
		}
}
?>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
<label>Your UserName:</label><br><input type="text" size="30" name="username"><br><br>
<label>Your Password:</label><br><input type="password" size="30" name="password"><br><br>
<input type="submit" name="login" value="Login to your Account">
</form>

Link to comment
https://forums.phpfreaks.com/topic/67586-solved-wierd-message/
Share on other sites

Well, you have to give the session a value. I'm guessing the value would be the users username...If you don't want to assign a value to it, just do this:

 

$_SESSION['username'] = TRUE;

 

The value of the session is what would be displayed if you echoed it out.

Link to comment
https://forums.phpfreaks.com/topic/67586-solved-wierd-message/#findComment-339519
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.