Help with PHP

hmig89

Free Member
Jun 24, 2010
186
30
Hi Guys,

I am getting the error below, I have had a google but still not really finding a solution.

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

Php code on page:

<?php
session_start();
define('ACCESS_PERMISSION', 1);

if($_GET['t'] == logout)
{ unset( $session_admin_level ); unset( $session_admin ); session_destroy();}

require_once('../includes/configuration.php');
require_once('../includes/database.php');

//-- Set the site settings
require_once("$config[site_path]includes/language_$config[site_language].php");
require_once("$config[site_path]includes/class.php");

//-- Set the page navigation start point to 0 if it isn't set
$common->session_variable();
if(!isset($start))
{ $start = 0; }

//-- Check to see if we need to process a form
if(isset($submit))
{
$component_process = $common->process_page();

if(!include("$config[site_path]components/$c/$s/_admin/process.php"))
{ $msg = $lang['error_file_not_found']."<br />$config[site_path]components/".$component_process."process.php"; }
}
else if(isset($c))
{
//-- Set the class for the current section
require_once("$config[site_path]components/$c/language_$config[site_language].php");
require_once("$config[site_path]components/$c/class.php");
if(isset($s))
{
require_once("$config[site_path]components/$c/$s/language_$config[site_language].php");
require_once("$config[site_path]components/$c/$s/class.php");
}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<title><?php echo $config['site_name'];?> : Administration</title>


<style type="text/css" media="screen,print">
<!--
@import url("admin.css");
-->
</style>

<script language="javascript" src="<?php echo $config['site_address'];?>includes/javascript/common.js" type="text/javascript"></script>
<script language="javascript" src="<?php echo $config['site_address'];?>includes/ajax/common.js" type="text/javascript"></script>


</head>

<body>

<div id="header">
<img src="images/logo.png" alt="<?php echo $config['site_name']?>" hspace="2" vspace="2" align="right" />

<?php
if($session_admin_level == 99)
{
?>
<div id="header_menu">
<a href="index.php" onmouseover="showit('home')">Admin Home</a>
<a href="index.php?c=users" onmouseover="showit('users')"><?php echo $lang['users'];?></a>
<a href="index.php?c=menu" onmouseover="showit('menu')"><?php echo $lang['menu'];?></a>
<a href="index.php?c=content" onmouseover="showit('content')"><?php echo $lang['content'];?></a>
<a href="index.php?" onmouseover="showit('components')"><?php echo $lang['components'];?></a>
<a href="index.php?c=administration" onmouseover="showit('administration')"><?php echo $lang['administration'];?></a>
<a href="index.php?t=logout"><?php echo $lang['logout'];?></a>
</div>
<?php
}
?>
</div>

<div id="container_1">
<div id="container_2" align="center">
<div id="menu_display" onmouseover="clear_delayhide()" onmouseout="resetit(event)"></div>
<div id="message_display">
<?php echo $msg != '' ? $common->error_display($msg) : ''; $msg = '';?>
</div>
<br />
<?php
if($session_admin_level == 99)
{
if(isset($c))
{ include("$config[site_path]components/$c/$s/_admin/index.php");}
else
{ include("$config[site_path]components/administration/_admin/main.php"); }
}
else
{
include("$config[site_path]components/administration/_admin/login.php");
}
?>
</div>

<div id="footer">
<ul>
<li id="copyright">© 2007 <?php echo $config['site_name'];?>.</li>
</ul>
</div>
</div>
<script>
if(document.getElementById('message_display'))
{ fadeOut('message_display', 100); }
</script>

<script language="JavaScript1.2">

/*
Tabs Menu (mouseover)- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var submenu = new Array()

//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.

// Create the items for the 'content'
<?php
$menu_headers = array('home', 'users', 'content', 'administration', 'components');
for($x = 0; $x < count($menu_headers); $x++)
{
$this_menu = "";
$sql = "SELECT * FROM components WHERE menu_admin = '$menu_headers[$x]' ORDER BY sequence";
$items = mysql_query($sql, $connect);
while($item = mysql_fetch_object($items))
{
$this_menu .= "<a href=\"index.php?c=$item->c&s=$item->s&t=$item->t\">$item->name</a> | ";
}
echo "submenu['".$menu_headers[$x]."'] = '$this_menu';\n";
}

$this_menu = "";
$sql = "SELECT * FROM menu_positions ORDER BY name";
$items = mysql_query($sql, $connect);
while($item = mysql_fetch_object($items))
{
$this_menu .= "<a href=\"index.php?c=menu&s=&t=list&menu_group=$item->name\">$item->name</a> | ";
}
echo "submenu['menu'] = '$this_menu';\n";

?>
//Set delay before submenu disappears after mouse moves out of it (in milliseconds)
var delay_hide = 50000

/////No need to edit beyond here

var menuobj=document.getElementById? document.getElementById("menu_display") : document.all? document.all.menu_display : document.layers? document.dep1.document.dep2 : ""

function showit(which)
{
clear_delayhide()
thecontent=(which==-1)? "" : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers)
{
menuobj.document.write(thecontent)
menuobj.document.close()
}
}

function resetit(e)
{
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout("showit(-1)",delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout("showit(-1)",delay_hide)
}

function clear_delayhide()
{
if (window.delayhide)
clearTimeout(delayhide)
}

function contains_ns6(a, b)
{
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

</script>
</body>
</html>

Any help with this would be greatly appreciated.

Thanks
Hugo
 
[FONT=verdana, geneva, lucida, arial]Thanks 10032012[/FONT]

I tired that and it seemed to make the error message go away but not actually fix the issue. This is for a charity and their web guy has done a runner to australia and im trying to help out, although im more of an It guy than a web guy, not familar with php at all. From googling it looks like it something to do with $_session, Session_register but can't see that in the code for that apge anywhere. Thanks for trying, it's appreciated.
 
Upvote 0
Does the site work but the error only appear if you are in the admin area?

The session thing is to do with cookies - it appears that the code is using a depreciated function which is why you get the error message. There are fixes but that can leave you open to a whole bunch of security issues.

So is the problem to do with login or the whole site?
 
Upvote 0
Does the site work but the error only appear if you are in the admin area?

The session thing is to do with cookies - it appears that the code is using a depreciated function which is why you get the error message. There are fixes but that can leave you open to a whole bunch of security issues.

So is the problem to do with login or the whole site?

Hey Fisicx,

The main site works fine, but the people who run this charity have not been able to update as when they login to the admin area it logs them straight back out again. the seems seems to be just a static site, they do not have a CMS like WP or Jooma. the have this admin portal which seems to be in PHP and this is where the problem is occuring. so normally they go to theirsite/admin and login to the admin page, however since a while back they seem to have issues, with that erro coming up on the login page and then when they login they usually select which area of the site to edit ie left menu, right menu etc, but that keeps taking them back to the admin login to login again and the cycle just repeats.
 
Upvote 0
Have they recently moved to a new server/hosting, or had some software updates applied on it?

If they're hosted on a dedicated server or VPS, the quick solution (and one that makes me shudder slightly) would be to install an old version of PHP 4.2.2 or earlier.
 
Upvote 0
That's what I thought.

They can't login because there is a disconnect between the server and the cookie function. This means the server isn't recognising their cookies and they get thrown out.

I'm not even sure this is the problem page. It looks like the previous login page is where is all starts to go wrong.

The only way to fix this is for someone to rewite the code to meet the current php standards. Your best bet is for the charity to find a local developer who can do the job, shouldn't take more than a couple of hours.
 
Upvote 0
Also, has the site moved to a different domain or anything like that? (e.g. example.com, or you're now using www.example.com). You can only set and access cookies that are on the same domain the site is accessed from, so if the previous developer hard-coded in the site's domain, that could explain things.

Finally, this could potentially also apply if the path the admin area is in has changed. So if previously it was at http://example.com/administrator and has now been moved to http://example.com/admin that could potentially cause it. Although in all honesty, it's been a while since I saw someone tie down their cookies with hard-coded paths.
 
Upvote 0
Hey, guys.

Thanks for the awesome support. I have been looking and they have always been with the same host and the admin page has always been on the same link. The PHP I posted was from the admin login page.

On that PHP code it also seems to reference to other PHP files configuration.php and database.php.

I can't seem to find a php.ini file anywhere. As as they are aware they have always access the site and admin page using www. Tried with and without but got same results. I am guessing the host has updated their php version possibly?

Will try and see if I can find anyone to do the work. Cheers all once again.
 
  • Like
Reactions: fisicx
Upvote 0
Hey guys,

I have spoken to the charity and if anyone is willing to quote on this, they are able to pay. They did not speify a budget, but as long as they can afford they will do it, I am offering the work here first as I would rather trust someone from here. If you are interested please let me know. If you need more information, please PM me.

Thanks
Hugo
 
Upvote 0
I'm super over loaded but if no one else pipes up by tomorrow please send me an email and I will help you out

Hi edmond,

I had fisicx look at the PHP code and it was very messy and it looks like it was copied from another site and the values changed. Also the code was 8 years old :O

I have advised them they need a new website. Will see what they say.

Thanks once again for your offer.

ps - Do you have any experience with kashflow API?
 
Upvote 0

Latest Articles