Jump to content

[SOLVED] Session Side Error Message


codexx

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.
}
}
  }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.