you have to register the variable after it is set, not before. also only register the 
variable once, dont keep re-registering it, some builds ie php-4.0.5 (snap) doesnt 
like re-registering vars (sometimes).

<?php

 include_once('time.egn');

 if ( isset($PHPSESSID) )
  session_id($PHPSESSID);

 session_start();

 if (!isset($HTTP_SESSION_VARS['SessionID']))
 {
  $SessionID = mtime();
  session_register('SessionID');
 }

 $PHPSESSID = session_id();
 $SID = "PHPSESSID=$PHPSESSID";

?>

this is my session file, works great for me.


-- 

 Chris Lee
 [EMAIL PROTECTED]



""Weerapong Sirikanya"" <[EMAIL PROTECTED]> wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I have problem about using session with php that have version newer than 4.03pl1.
this is the test code.
-----------------
test_session.php
-----------------
<?php
session_start();
session_register("abc");
print "\$PHPSESSID -> $PHPSESSID<br>";
$abc = 1;
?>
<A HREF="test_session2.php">test_session2</A>
-------------------------------------------------------
result is:
$PHPSESSID -> 16529ad58656fc32ec826430b7b1e08b
test_session2  
------------------
test_session2.php
------------------
<?php
print "\$PHPSESSID -> $PHPSESSID<br>";
print "\$abc   -> $abc<br>";
?>
-------------------------------------------------------
result is:
$PHPSESSID -> 16529ad58656fc32ec826430b7b1e08b
$abc ->  

this is the configuration:
Session Support enabled
Directive                    Local Value        Master Value
---------                    -----------       ------------
session.auto_start           Off               Off
session.cache_expire        80               180
session.cache_limiter        nocache       nocache
session.cookie_domain      no value       no value
session.cookie_lifetime      0                 0
session.cookie_path          /                 /
session.cookie_secure       Off              Off
session.entropy_file          no value       no value
session.entropy_length      0                0
session.gc_maxlifetime      1440            1440
session.gc_probability       1                 1
session.name                   PHPSESSID    PHPSESSID
session.referer_check        no value       no value
session.save_handler         files             files
session.save_path             /tmp            /tmp
session.serialize_handler     php             php
session.use_cookies           On              On<br clear=all><hr>Get Your Private, 
Free E-mail from MSN Hotmail at <a 
href="http://www.hotmail.com">http://www.hotmail.com</a>.<br></p>



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