Jump to content

Recommended Posts

Hey Everyone,

 

My datacenter updated their php version and I am getting this error. (Its on a login page)

 

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

 

my code being used is:

 

  <? if ($_POST['username'] && $_POST['password']) {

	  $username = $_POST['username'];
	  $password = $_POST['password'];
	  
	dbConnect();
	$pass = md5($password);
			$result = mysql_query(" SQL QUERY");
			if (mysql_num_rows($result) == 0) { 
		                       ?>
// Invalid Page
<?
                            }else{
					   while ($row = mysql_fetch_assoc($result)) {
	//REGISTER SESSION
		session_register("*valuehere*");

 

Thanks in Advance,

Sean

 

Link to comment
https://forums.phpfreaks.com/topic/55025-solved-session-side-error-message/
Share on other sites

If your script uses session_register(), it will not work in environments where the PHP directive register_globals  is disabled.

 

register_globals: important note: Since PHP 4.2.0, the default value for the PHP directive register_globals is off, and it is completely removed as of PHP 6.0.0.

 

http://ca.php.net/manual/en/function.session-register.php

untested but i am sure it ok.

 

<?php session_start();

// database connection

$db=mysql_connect("localhot","username","password");
mysql_connect_db("datebase_name",$db);

// post user_name and password.

$username = $_POST['username'];
$password = $_POST['password'];

// if the condition is posted

if ($_POST['username'] && $_POST['password']) {

// swap varables

$pass = md5($password);		

$pass=$_POST['pass'];

$query="select * from colum where password='$pass'";

if (mysql_num_rows($result) == 0) { 

// echo message or redirect user.
		                       
}else{

while ($row = mysql_fetch_assoc($result)) {

$_SESSION['name']=$row['user_name'];
$_SESSION['password']=$row['password'];

// send message or redirect user.
}
}
  }
?>

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.