...

View Full Version : Unknown Error



MHaris
08-17-2007, 12:37 AM
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

This only happens when I register the sessions for the first time, if I try to re-login with the sessions already registered, the error doesn't comes up.

index.php


<?php

// Last Modified 16th August

ob_start();

include('templates/header.php'); // Header template
include('../config/config.php'); // Includes configuration files
include('../lib/functions.php'); // Load all functions from Library

include('templates/login.php'); // Login form

$submit = $_POST['log_in'];
$posted_username = sql_safe($_POST['username']);
$posted_password = sql_safe($_POST['password']);

if(isset($submit)){

if($posted_username == $username && $posted_password == $password){
echo "Logged in";
session_register("username");
session_register("password");
}
else {
echo "Wrong username or password";
}

}

?>

Any idea what might be the problem since I'm not using any global variables?

whizard
08-17-2007, 12:42 AM
except post.. i think those are global...

Dan

MHaris
08-17-2007, 12:45 AM
except post.. i think those are global...

Dan

Care to be a little more constructive?

whizard
08-17-2007, 12:54 AM
try adding this to the top:
ini_set('session.bug_compat_42','0');

btw, I wasn't being sarcastic in my first post...

HTH
Dan

MHaris
08-17-2007, 01:14 AM
Nevermind and Thanks.

CFMaBiSmAd
08-17-2007, 01:43 AM
Don't use session_register(). It is depreciated and only works when register_globals are on (and your code will stop working on PHP6.)

There is a big caution about this in the php manual section for that function - http://php.net/session_register



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum