Hi,

I got the same problem but i left it (had no more time to fumble around
with it). But try this, because it was what I was going to try:

function ccsession($userid = '1', $groupid = '1', $authid = '1',
$username = 'guest', $first_name = 'Guest', $last_name = 'Account')
    {
        global $HTTP_SESSION_VARS;

        // Change all session variables below to
        // $this->_cm_user_id = $HTTP_SESSION_VARS["userid"]
        // and so on..

        $this->ss();    // I guess this is not important for sessions
        $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();
        
    }


// Once you started the session you might be able to set it
// the way you are doing here, in the following code as long 
// as you don't send anything before this. If you do it you 
// know you will have already sent the old ID to the user.

    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;
        //}
    }
}



By doing this you should be able (and I say SHOULD, I haven't tested it)
to get the value from the session, but you will still have to start the
session outside the class.

Also don't forget to change the $HTTP_SESSION_VARS with the new session
information if you change it.

>From my point of view the problem is with variable scope. Even with
register_globals and track_vars the code didn't work for me. If you find
out something please post it (or at least send me a message with your
findings) because actually I was doing that stuff with just functions
and not a class.

Hope it's useful for you.

        Sean C. McCarthy
        SCI, S.L. (www.sci-spain.com)

Mark Garcia wrote:
> 
> 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, ...
>

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

Reply via email to