ID: 21083
Comment by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Session related
Operating System: Win98SE
PHP Version: 4.2.3
New Comment:
Here's the script that works both Linux&Win98SE
session_start();
if(!session_is_registered('ind'))
{
$ind = 0;
session_register('ind');
session_register("table[$ind]");
$_SESSION["table[$ind]"] = 1;
}
else
{
$ind = $_SESSION['ind'];
//Lis�t��n alkio tauluun
session_register("table[$ind]");
$_SESSION["table[$ind]"] = 1;
}
//increases the index
$ind++;
$_SESSION['ind'] = $ind;
$i= 0 ;
//prints all the data in $table
while ($i < $ind)
{
print($_SESSION["table[$i]"] . "<br>");
$i++;
}
Previous Comments:
------------------------------------------------------------------------
[2002-12-18 13:40:16] [EMAIL PROTECTED]
First here's the whole script:
<?php
session_start();
if(!session_is_registered('ind'))
{
$ind = 0;
session_register('ind');
$table[$ind] = 1;
session_register("table");
}
else
{
$ind = $_SESSION['ind'];
//Lis�t��n alkio tauluun
$table[$ind] = 1;
session_register("table");
}
//increases the index
$ind++;
$_SESSION['ind'] = $ind;
$i= 0 ;
//prints all the data in $table
while ($i < $ind)
{
print("$table[$i]<br>");
$i++;
}
?>
I have tested this script both Linux(script works perfectly) and
Win98SE(doesn't work). Both have Apache and PHP 4.2.3.
So I'm using session cookie $table where to store number 1 in each
index. Index increases every time i press refresh. Script should print
(after three refresh):
1
1
1
1
But with my Windows scripts prints (after three refresh):
Notice: Undefined offset: 0 in c:\www\sessio_taulu_testi.php on line
32
Notice: Undefined offset: 1 in c:\www\sessio_taulu_testi.php on line
32
Notice: Undefined offset: 2 in c:\www\sessio_taulu_testi.php on line
32
1
When entering the script for the first time scripts prints correctly:
1
I have deleted the session file after each time I've executed the
script, so that shouldn't be the problem.
I would like to know what's the problem in here :)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21083&edit=1