Hi, I have some include files that I want to randomly display on my page. The name of the files always starts with "include-" and always has ".php" as extension. All the files are in the folder /sidebox.
At some point I got this code here:
<?php
$available_files=array();
$dir=opendir($DOCUMENT_ROOT.'/sidebox');
while($file=readdir($dir)) {
if(substr($file, 0, 8) == "include-" and substr($file, -4) == ".php")
$available_files[]=$file;
}
$selected_files = array_rand($available_files,2);
foreach($selected_files as $file)
{
include $available_files[$file];
}
?>
but I get the following errors:
Warning: open_basedir restriction in effect. File is in wrong directory in /home/vhosts/chaindlk.net/httpdocs/test.php3 on line 23
Warning: Failed opening 'include-add_link_v.php' for inclusion (include_path='.:') in /home/vhosts/chaindlk.net/httpdocs/test.php3 on line 23
Warning: open_basedir restriction in effect. File is in wrong directory in /home/vhosts/chaindlk.net/httpdocs/test.php3 on line 23
Warning: Failed opening 'include-allposters_locallink.php' for inclusion (include_path='.:') in /home/vhosts/chaindlk.net/httpdocs/test.php3 on line 23
I also tried the above code with:
$dir=opendir("/home/vhosts/chaindlk.net/httpdocs/sidebox");
but still no luck!
At one point I had Nuke installed on my server and Nuke has this feature of randomly including files on a page so I know there has to be some way around this even with open_basedir restrictions in effect (even though I don't really know what open_basedir restrictions are)...
Please help!
Thanks