I meet a probleme with the session.
My example considers 2 scripts :
- the first script (test_session_url.php) opens a session
(session.auto_start=1 in php.ini), defines a counter,
prints some information and an hypertext to execute the second script
which
has session id as parameter
----------------------------------------------------------------------------
<?php
$_SESSION['count']= 1;
echo "<HTML><TITLE>Session and URL</TITLE><BODY>";
echo "hello ! : it's ".$_SESSION['count']." visit";
echo "<br><br> Information :<br>";
echo "--->name = ".session_name()."<br>";
echo "--->id = ".session_id()."<br>";
echo "<A HREF=nextpage_session_url.php?";
echo session_name()."=".session_id();
echo ">next page</A>";
echo "</BODY></HTML>";
?>
----------------------------------------------------------------------------
- the second script (nextpage_session_url.php) validates the parameter
(set, empty, value), add one to the counter and then check the value of
the counter. It makes the same thing
5 times by printing an hypertext with itself and after, it prints an new
hypertext to come back to the first script by beginning a NEW SESSION.
----------------------------------------------------------------------------
<?php
if ( !isset($_GET[session_name()]) || empty($_GET[session_name()]) )
{
echo "<HTML><TITLE>Session and URL</TITLE><BODY>";
echo "parameter error";
echo "</BODY></HTML>";
exit;
}
$id= $_GET[session_name()];
if ( $id != session_id() )
{
echo "<HTML><TITLE>Session and URL</TITLE><BODY>";
echo "value of session id error : <BR>";
echo "parameter : $id and current session_id :".session_id()."--";
echo "</BODY></HTML>";
}
else
{
$_SESSION['count']++;
if ( $_SESSION['count'] > 5 )
{
$_SESSION= array();
session_destroy();
session_start(); // problem is the same with or without this
instruction
include("test_session_url.php");
}
else
{
echo "<HTML><TITLE>Session and URL</TITLE><BODY>";
$cpt = $_SESSION['count'];
echo "hello ! : it's ".$_SESSION['count']." visit";
echo "<br><br> Information :<br>";
echo "--->name = ".session_name()."<br>";
echo "--->id = ".session_id()."<br>";
echo "<A HREF=nextpage_session_url.php?";
echo session_name()."=".session_id();
echo ">next page</A>";
echo "</BODY></HTML>";
}
}
?>
----------------------------------------------------------------------------
Now my problem : NEVER a new session (with a new ident) is created.
However I execute $_SESSION= array(); and session_destroy();
I use php 4.2.3 and apache 1.3.26
For testing, I configurate my browser to refuse the cookies (but the
problem
is the same when I accept the cookies).
Perhaps something to change in php.ini ?
In advance thanks.
mb
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php