HI,
Is there a bug for cookies not being set using php setcookie function for IE.
I've tested the following code in Netscape and it workds like a charm but in IE i get different results. I've looked in windows/cookies directory with no entries.
I don't get it
Any comments
<?php
$SECS_PER_DAY = "86400";
$NUMBER_OF_DAYS = "30";
$DOMAIN = getenv("HTTP_HOST");
$PATH = '/downloads/';
$id = $HTTP_COOKIE_VARS["id"];
//if there's a valid cookie set
if ( isset($id) ) {
//if the html form has been submmitted with a valid filesrc
if ( isset($HTTP_POST_VARS["filesrc"]) ) {
$fileName = "$filesrc";
$filesize = filesize($fileName);
if($filesize) {
Header("Content-Type: application/pdf");
Header("Content-Length: ".$filesize);
Header("Content-Disposition: attachment; filename=".$fileName);
@readfile($fileName);
}
} else {
//most likely the user typed in the url in the location bar
header( "Location: http://$DOMAIN$PATH/error.php" );
}
exit;
} else {
//set the cookie and expiration date
//create a random unique id
srand((double)microtime()1000000);
$randval = rand();
//set the expiration time in seconds
//$EXPIRATION = time() + $NUMBER_OF_DAYS $SECS_PER_DAY;
$EXPIRATION = time()+60;
setcookie("id", $randval, $EXPIRATION, "/");
//print "\$EXPIRATION = $EXPIRATION<br>";
//print "\$id = $randval<br>";
.......
?>