setcookie problem
Posted: Thu Nov 13, 2008 1:55 pm
I've been looking at this code for the last 2 days and just can not figure out the mistake.
The test consist of 2 files trying to set and read the same cookie.
file1:
<?php
$hour = time() + 3600;
setcookie( 'ID_FT1', "me2", $hour);
$xtmp_ck = $_COOKIE['ID_FT1'];
echo nl2br("\n x022 name: $xtmp_ck \n");
?>
file2:
<?php
$hour = time() + 3600;
setcookie( 'ID_FT1', "me3", $hour);
$xtmp_ck = $_COOKIE['ID_FT1'];
echo nl2br("\n x023 name: $xtmp_ck \n");
?>
these files allready exist at followtrader.com/test2.php and test3.php.
output of displaying test2 the 1st time is:
x022 name:
the 2nd time:
x022 name: me2
If you display test3, then sometimes you will see inconsistent results too.
Any ideas would be appreciated.
BeattheDart group.
The test consist of 2 files trying to set and read the same cookie.
file1:
<?php
$hour = time() + 3600;
setcookie( 'ID_FT1', "me2", $hour);
$xtmp_ck = $_COOKIE['ID_FT1'];
echo nl2br("\n x022 name: $xtmp_ck \n");
?>
file2:
<?php
$hour = time() + 3600;
setcookie( 'ID_FT1', "me3", $hour);
$xtmp_ck = $_COOKIE['ID_FT1'];
echo nl2br("\n x023 name: $xtmp_ck \n");
?>
these files allready exist at followtrader.com/test2.php and test3.php.
output of displaying test2 the 1st time is:
x022 name:
the 2nd time:
x022 name: me2
If you display test3, then sometimes you will see inconsistent results too.
Any ideas would be appreciated.
BeattheDart group.