Greetings,
I'm having a puzzling time trying to figure out how to work around the issue
of the session_id not existing after making calls to session_start and
session_id to generate an session. It seems that by set_si() calling
session_id and seeing if there is a value, doesn't not work. Hence, a new
session_id is created but is not persistant. If I reload the page
sessions.test.php3 it generates a new session_id and can not detect the
previous one set.
For example, I one it once, and it produces output to the browser as:
==
--84c666bde8c46803a10821e32aacff91
++84c666bde8c46803a10821e32aacff91
If I reload the page by chosing "refresh" it produces:
==
--8855c34496314baacd73d3de0bc59b49
++8855c34496314baacd73d3de0bc59b49
Is this a bug in PHP where you cannot call session function within a
function of a class and have it stick? Any help would be greatly
appreciated.
->MAG
<<sessions.inc>>
class ccsession {
var $_cm_user_id = '';
var $_cm_group_id = '';
var $_cm_auth_id = '';
var $_username = '';
var $_first_name = '';
var $_last_name = '';
var $_session_id = '';
var $is_set_si = '';
var $is_get_si ='';
var $is_sd = '';
var $is_ss = '';
var $is_sn = '';
var $is_sr = '';
var $is_su = '';
function ccsession($userid = '1', $groupid = '1', $authid = '1',
$username = 'guest', $first_name = 'Guest', $last_name = 'Account')
{
$this->ss();
$this->_cm_user_id = $userid;
$this->_cm_group_id = $groupid;
$this->_cm_auth_id = $authid;
$this->_username = $username;
$this->_first_name = $first_name;
$this->_last_name = $last_name;
$this->_session_id = $this->set_si();
}
// Shortcuts...
function set_si()
{
//if (0) {
//$c_session_id = $this->get_si();
print "==".session_id()."<br>";
if (session_id()) {
$this->_session_id = $c_session_id;
} else {
srand((double)microtime()*1132590); // make 'rand' function
truly random
$this->_session_id = md5(rand(0,9999999));
}
$this->is_set_si = 1;
session_id($this->_session_id);
print "--".session_id()."<br>";
return $this->_session_id;
//}
}
}
<<sessions.test.php3>>
<?php
include 'class/sessions.inc';
$n_sess = new ccsession();
print "++".session_id()."<br>";
?>
PHP Version 4.0.3pl1
System Linux skritz 2.2.5 #4 SMP Tue May 2 11:26:16 PDT 2000 i686 unknown
Build Date May 15 2001
Configure Command './configure' '--with-apache=../apache_1.3.12' '--with-db'
'--with-mcal=../libmcal'
Server API Apache
Apache Version Apache/1.3.12
Apache Release 10312100
Apache API Version 19990320
Hostname:Port my.domain.com:80
User/Group www(2001)/100
Max Requests Per Child: 0
Keep Alive: on
Max Per Connection: 100
Timeouts Connection: 300
Keep-Alive: 15
Server Root /usr/local/apache
Loaded Modules mod_php4, mod_setenvif, mod_auth, mod_access, mod_alias,
mod_userdir, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir,
mod_autoindex, mod_include, mod_status, mod_negotiation, mod_mime,
mod_log_config, mod_env, http_core
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]