I have the following functions:
function register_session( $user, $pwd )
{
session_start();
$_SESSION['username'] = $_user;
$_SESSION['password'] = $pwd;
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
}
function session_logged()
{
session_start();
if( isset( $_SESSION['username'] ) &&
isset( $_SESSION['password'] ) &&
$_SESSION['ip'] == $_SERVER['REMOTE_ADDR'] )
return true;
else
return false;
}
I'm trying to make it work with register_globals off.
I've already changed session.save_path = c:\windows\temp\
On every page I do the following:
if( session_logged )
{
... code here
}
else
{
die( 'you are not logged');
}
But when I run this code ( the session_logged function ) I get the following errors:
Warning: Undefined index: username in c:...\class.session.php on line 121
Warning: Undefined index: password in c:...\class.session.php on line 122
Warning: Undefined index: ip in c:...\class.session.php on line 123
Does anybody knows the problem?? 😕