Hi James,

Well for what it's worth:

Your code in Test1 sets the paraemters -
if(!$_SESSION['start_time']){
        echo("\n Session Reset<BR>");
        $_SESSION['start_time'] = time();

yet when Test2 loads, you haven't called $_SESSION[''start_time'} nor, for 
that matter, have you 'saved' it using session_write_close(); 
Therefore when the Test2 loads, time is not set, so when it returns to Test1 
and hits the above condition, it will write a new time, and hence a new 
session.

I presume two things; 1. that you have <?php session_start(); ?> as opener 
lines on each page  and 2. that register_globals=off. The last thing caused 
all sorts of grief for me last week - messes up sessions if 'on'

Hth,
Andre

On Friday 13 August 2004 10:37 am, James E Hicks III wrote:
> OK, so it wasn't the nut behind the wheel after all. I am still having
> problems with sessions after upgrading to PHP 4.3.8. The test code below
> works as expected on server equipped with PHP 4.3.6 and keeps the session
> start time the same no matter what link you click on. However with version
> 4.3.8 when you click on the last link on the page it will start a new
> session and the session start time will be updated. What can I change to
> fix this?
>
> All the session related php.ini settings are the same on both servers and I
> will repost that information here. Both servers are running the same
> version of Apache, Server version: Apache/1.3.27 (Unix)  (Gentoo/Linux).
>
> ## Session settings in php.ini
> [Session]
> session.save_handler = files
> session.save_path = /tmp
> session.use_cookies = 1
> ; session.use_only_cookies = 1
> session.name = PHPSESSID
> session.auto_start = 1
> session.cookie_lifetime = 0
> session.cookie_path = /
> session.cookie_domain =
> session.serialize_handler = php
> session.gc_probability = 1
> session.gc_divisor     = 100
> session.gc_maxlifetime = 1440
> session.bug_compat_42 = 1
> session.bug_compat_warn = 1
> session.referer_check =
> session.entropy_length = 0
> session.entropy_file =
> ;session.entropy_length = 16
> ;session.entropy_file = /dev/urandom
> session.cache_limiter = nocache
> session.cache_expire = 180
> session.use_trans_sid = 0
> url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
>
> And here is the example code that I am having trouble with.
>
> SESSION_TEST1.php
>
> <?php
> echo("\n <HTML><HEAD><TITLE>SESSION TEST</TITLE>");
> echo("\n <SCRIPT LANGUAGE=\"JavaScript\">");
> echo("\n <!-- Begin ");
> echo("\n function popUpBI(URL) { ");
> echo("\n day = new Date(); ");
> echo("\n id = day.getTime(); ");
> echo("\n eval(\"page\" + id + \" = window.open(URL, '\" + id + \"',
> 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,widt
>h=400,height=400'); \"); ");
> echo("\n } ");
> echo("\n // End --> ");
> echo("\n </script>");
> echo("\n </HEAD><BODY>");
> if(!$_SESSION['start_time']){
>       echo("\n Session Reset<BR>");
>       $_SESSION['start_time'] = time();
> }
> echo("\n <BR>Session Start Time -".date("M/d/Y h:i:s",
> $_SESSION['start_time']));
> echo("\n <form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">");
> echo("\n <BR><input type=\"submit\" name=\"submit\" value=\"THIS
> WORKS\">"); echo("\n </form>");
> echo("\n <BR><A HREF=\"SESSION_TEST1.php\">THIS ALSO WORKS</A>");
> echo("\n <BR><BR><A HREF=\"javascript:popUpBI('SESSION_TEST2.php')\">THIS
> STARTS NEW SESSION</A>");
> echo("\n </BODY></HTML>");
> ?>
>
> SESSION_TEST2.php
>
> <?php
> echo("\n <HTML><HEAD><TITLE>SESSION TEST 2</TITLE></HEAD><BODY>");
> echo("\n Now there is new session and the other window will update with new
> time<BR>");
> echo("\n <BR><a href=\"javascript:window.close();\"><font>Close This
> Window</font></a>");
> echo("\n </BODY></HTML>");
> ?>
>
> Help!!!!
>
> James Hicks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to