Hi--
I am using the following PHP code to retrieve a random text entry from a msg.dat file, but the code does not seem to work in IE 7 (but does work in FireFox, Mozilla, and Safari). It will generate two entries at random, and then it will continue to show the second entry without randomly picking any more. The code is:
<?php
srand((double)microtime()*1000000);
$filename="msg.dat";
$message=file($filename);
$select=rand(0, count($message)+1);
$msg = "msg=$message[$select]";
echo "$msg";
?>
Does anyone have any idea of why this is happening, and even better, how to fix it? Many, many thanks for any help!!!!
get_random.phtml not working with IE 7--HELP!
Moderator: General Moderators
Re: get_random.phtml not working with IE 7--HELP!
I imagine IE7 is caching the page. Try sticking something like this at the top:
Code: Select all
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");Re: get_random.phtml not working with IE 7--HELP!
Hi--
Thanks very much for your quick reply--
Just to make sure (I am really new at this!). The beginning of the file should look like this?
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
OR do I leave out the words "header"?
Again, many thanks!
Thanks very much for your quick reply--
Just to make sure (I am really new at this!). The beginning of the file should look like this?
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
OR do I leave out the words "header"?
Again, many thanks!
Re: get_random.phtml not working with IE 7--HELP!
You could always try both and see what happens.
Re: get_random.phtml not working with IE 7--HELP!
OK, thanks for all your help! I appreciate it!