I have some code that works on another site which rotates my webpages. First visitor will see zzz0.htm, the second will see zzz1.htm, until zzz3.htm. Then they see zzz0.htm again. Rotating, right?
My code works fine on my other website but fails to work on futurequest.
I have .htaccess as follows...
AddType application/x-httpd-php .htm
AddHandler application/x-httpd-php .htm
This is so my index_test.htm page is treated like a php page. All files, including count.inc are in the main directory.
It works fine on my other site, as already stated. However, I have problems getting it to work with my futurequest.com hosting account. I believe the reason MAY be because they are running in \"safe_mode\". This impacts on the include() statement (I think).
My code that rotates the pages is...
[PHP<?php
//Simple PHP headline swapper
if (file_exists(\'count.inc\'))
{
//if file exists..read the last supplied file.
$fil = fopen(\'count.inc\', \'r\');
$dat = fread($fil, filesize(\'count.inc\'));
fclose($fil);
}
else
{
//if it doesnt exist. create one.
// in ur code , if file doesnt exist, it wont display any headers. i have corrected it here.
$fil = fopen(\'count.inc\', \'w\');
fwrite($fil, 0);
fclose($fil);
$dat = 0;
}
//using include to display the appropriate page:
$filename = \'zzz\'.$dat.\'.htm\';
include(\"$filename\");
// my approach for rewinding value of dat..
if($dat > 2) {
$dat = 0;
}
else
{
$dat++;
}
//now write in the new value...
$fil = fopen(\'count.inc\', \'w\');
fwrite($fil, $dat);
fclose($fil);
?>
[/code]
Can anyone see a reason why this code does not run, especially since I just copied and pasted it from my other site? Or, because of the impact of safe_mode, what can I do to rememdy the situation?
Thanks,
Jon