It just simply doesn't work but at least now I get some errors to work on instead of a blank page...
I created a file called: test.php3 whose content looks like this:
<html>
<head>
<title>CHAIN D.L.K. | TEST</title>
<link rel="STYLESHEET" type="text/css" href="/chaindlk.css">
</head>
<body>
<?php
if ( $dir = @opendir('./')){
while($file = readdir($dir)){
if (substr($file, 0, 8) == "include-" and substr($file, -4) == ".php") {
array_push($file_ara,$file);
srand ((float) microtime() * 10000000);
$rnd_key = array_rand($file_ara);
echo "including $file_ara[$rnd_key]<br>";
include $file_ara[$rnd_key];
}
}
}
?>
</body>
</html>
The I have created 5 files whose names start with include- and end with .php.
I have put test.php3 in the same folder of the 5 include files and I have got the following error messages:
Warning: First argument to array_push() needs to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 13
Warning: Argument to array_rand() has to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 15
including
Warning: Failed opening '' for inclusion (include_path='.:') in /usr/local/server/httpdocs/sidemenus/test.php3 on line 17
Warning: First argument to array_push() needs to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 13
Warning: Argument to array_rand() has to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 15
including
Warning: Failed opening '' for inclusion (include_path='.:') in /usr/local/server/httpdocs/sidemenus/test.php3 on line 17
Warning: First argument to array_push() needs to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 13
Warning: Argument to array_rand() has to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 15
including
Warning: Failed opening '' for inclusion (include_path='.:') in /usr/local/server/httpdocs/sidemenus/test.php3 on line 17
Warning: First argument to array_push() needs to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 13
Warning: Argument to array_rand() has to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 15
including
Warning: Failed opening '' for inclusion (include_path='.:') in /usr/local/server/httpdocs/sidemenus/test.php3 on line 17
Warning: First argument to array_push() needs to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 13
Warning: Argument to array_rand() has to be an array in /usr/local/server/httpdocs/sidemenus/test.php3 on line 15
including
Warning: Failed opening '' for inclusion (include_path='.:') in /usr/local/server/httpdocs/sidemenus/test.php3 on line 17
I hope somebody can figure this out, I am not sure where to start from... Thanks!