Page 1 of 1
PHP Session Error
Posted: Sun Oct 30, 2011 2:59 pm
by YoussefSiblini
Hi,
I want to change error reporting to not show warnings, since I am getting this error:
Code: Select all
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
How can I do that please, I have tried to do it from this link
http://us2.php.net/manual/en/function.e ... orting.php, but I am quit newb with this and I couldn't find how to do it
Youssef
Re: PHP Session Error
Posted: Sun Oct 30, 2011 3:58 pm
by flying_circus
Can you post some of your code?
It is easy to tell you how to disable those errors, but that isn't necessarily the "correct" answer. Simply disabling the errors is a bit like the ostrich syndrome, burying your head in the sand.
Where are you setting session variables and where are you using $GLOBAL or global?
Re: PHP Session Error
Posted: Sun Oct 30, 2011 4:03 pm
by YoussefSiblini
Thank you,
Here is the php code:
Code: Select all
<?php
// headers change between logged in and not logged in
session_start();
$header = '';
date_default_timezone_set('Europe/London');
$thisDay = date('l jS \of F Y h:i:s A');
$topBoxes = '';
if (!isset($_SESSION["manager"])) {
$header ='includes/header.php';
}
else
{
// Be sure to check that this manager SESSION value is in fact in the database
$managerID = $_SESSION["id"];
$IEmail = $_SESSION["manager"];
$pass = $_SESSION["password"];
include 'includes/connect_users.php';
$sql = mysql_query("SELECT * FROM members WHERE id ='$managerID' AND Email ='$IEmail' AND Password='$pass' LIMIT 1");
$existCount = mysql_num_rows($sql); // count the row nums
if ($existCount == 0)
{
$header ='includes/header.php';
}
else
{
while($row = mysql_fetch_array($sql))
{
$User_name = $row["User_name"];
$header = 'includes/header_Secure.php';
}
}
}
?>
Youssef
Re: PHP Session Error
Posted: Sun Oct 30, 2011 4:42 pm
by flying_circus
I can't spot any errors in this piece of code, that would trigger the error you are receiving. I would check in the rest of your included files as well.
You can use ini_set() to change the values of the directives mentioned in your error message
Code: Select all
ini_set('session.bug_compat_42', 0);
ini_set('session.bug_compat_warn', 0);
Re: PHP Session Error
Posted: Sun Oct 30, 2011 4:47 pm
by YoussefSiblini
What do I have to do with this code exactly? put it in ini.php and under the public_html folder?
Youssef
Re: PHP Session Error
Posted: Sun Oct 30, 2011 6:59 pm
by flying_circus
Try placing it in your .php file right before your session_start() call.