Hello all.
I have an problem:
I run (temporarily) PHP 4.3.6 with MySQL 4.1.0 database driven sessions on IIS (XP). My handler used to store/retrieve sess data (stored in php.ini) is:
session.save_handler = user
I have an table in wich I store my sessions (id, variables,...).
And thing works just fine - when I want my session to begin or continue I use sess_init(...) function from phpSecureSessions.inc file I have here.
MY PROBLEM IS IN FOLLOWING:
How to properely check if session is registered? Cause, if I have registered one, I would like my user (or visitor) to continue with session, but if session is not registered I want to start a new one for that user (I store users IP address and session variables along with standard session data).
I have this code (wich I changed, for example instead session_is_registered(...) I tried also to use if (!isset(session_id())){...} with no desirable results):
include ('phpSecureSessions.inc');
if (session_is_registered('visitor')){
sess_init('localhost','sessions','root','','1');
}
else
{
sess_init('localhost','sessions','root','','1');
$_SESSION['user']='visitor';
$_SESSION['datum']=date("Y M d.");
$_SESSION['vrijeme']=date("G:i:s");
$_SESSION['timezone']=date("T");
}
but I receive this result:
session id is unchanged for same user (comming from same IP) but session variables are changed, no matter that session is only continuing. What could be the solution for this?
Any idea?
PS
If neccesary, I'll post phpSecureSessions.inc file I have here, but I don't think the problem there.
Thanks!
I have an problem:
I run (temporarily) PHP 4.3.6 with MySQL 4.1.0 database driven sessions on IIS (XP). My handler used to store/retrieve sess data (stored in php.ini) is:
session.save_handler = user
I have an table in wich I store my sessions (id, variables,...).
And thing works just fine - when I want my session to begin or continue I use sess_init(...) function from phpSecureSessions.inc file I have here.
MY PROBLEM IS IN FOLLOWING:
How to properely check if session is registered? Cause, if I have registered one, I would like my user (or visitor) to continue with session, but if session is not registered I want to start a new one for that user (I store users IP address and session variables along with standard session data).
I have this code (wich I changed, for example instead session_is_registered(...) I tried also to use if (!isset(session_id())){...} with no desirable results):
include ('phpSecureSessions.inc');
if (session_is_registered('visitor')){
sess_init('localhost','sessions','root','','1');
}
else
{
sess_init('localhost','sessions','root','','1');
$_SESSION['user']='visitor';
$_SESSION['datum']=date("Y M d.");
$_SESSION['vrijeme']=date("G:i:s");
$_SESSION['timezone']=date("T");
}
but I receive this result:
session id is unchanged for same user (comming from same IP) but session variables are changed, no matter that session is only continuing. What could be the solution for this?
Any idea?
PS
If neccesary, I'll post phpSecureSessions.inc file I have here, but I don't think the problem there.
Thanks!