...

View Full Version : Problem with writing cookie in IE



SCwebbie
11-21-2006, 09:49 AM
I've written a flash movie that will show a slideshow of images that are uploaded with a cmm module. The movie will call a php script that will write an array to a cookie for the images allready shown.


<?php
$root = $_SERVER['DOCUMENT_ROOT'];
$host = $_SERVER['HTTP_HOST'];

$dir_1 = "/albums/album_2";

function countFiles($dir, $arrShown){
$numFiles = 0;
if($open = @opendir($dir)){
while($bestanden = readdir($open)){
$bestandsnaam = $dir."/".$bestanden;
if(is_file($bestandsnaam)){
$numFiles++;
}
}
}

$filesShown = count($arrShown);
if($filesShown < $numFiles){
$check = true;
}
else{
$check = false;
}

return $check;
}

if(empty($_COOKIE['exteriorList'])){
if($open = @opendir($root.$dir_1)){
$foundFirst = false;
while(($bestanden = readdir($open)) AND !$foundFirst){
$bestandsnaam = $dir_1."/".$bestanden;
if(is_file($root.$bestandsnaam)){
$imgInterior = $bestanden;

$arrImage[] = $bestanden;
$cValue = serialize($arrImage);
setcookie('exteriorList', "$cValue", time() + (60 * 60 * 24 * 2), "/", "$host");

$foundFirst = true;
}
}
}
else{
echo("no such image directorie found");
}
}
else{
$arrImages = unserialize($_COOKIE['exteriorList']);
/*print_r($arrImages);*/

if(countFiles($root.$dir_1, $arrImages)){
if($open = @opendir($root.$dir_1)){
$foundFirst = false;
while(($bestanden = readdir($open)) AND !$foundFirst){
$bestandsnaam = $dir_1."/".$bestanden;
if(!in_array($bestanden, $arrImages)){
if(is_file($root.$bestandsnaam)){
$imgInterior = $bestanden;

array_push($arrImages, $bestanden);
$cValue = serialize($arrImages);
setcookie('exteriorList', "$cValue", time() + (60 * 60 * 24 * 2), "/", "$host");

$foundFirst = true;
}
}
}
}
else{
echo("no such image directorie found");
}
}
else{
$imgInterior = $arrImages[0];
$arrImages = "";
$arrImages[] = $imgInterior;
$cValue = serialize($arrImages);
setcookie('exteriorList', "$cValue", time() + (60 * 60 * 24 * 2), "/", "$host");
}
}
echo("interior=".$imgInterior);

?>

In Firefox this script will work perfectly, but for some reason IE will only show the first image found in the image directorie.

I've tried to let the movie open up another script that will write the cookie in a "hidden" frame and let the other script give the image to the flash movie. IE will still not write the cookie.

I'm out of ideas and would really appreciate some help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum