Hi bro, kindly help out with this... <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/variables/variables.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/variables/random.php'; ?> ..... so how can i include a random page into this file? e.g because i got 67page to include on this page? how can i make it random.
Coding random Include page
Started on the old forum in April 2011 · view the original in the archive · old links redirect here
<?php
$filenames = array();
if ($handle = opendir('/variables')) {
$n = 1;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$filenames[$n] = $file;
$n++;
}
}
closedir($handle);
}
$num = rand(count($filenames));
include_once $_SERVER['DOCUMENT_ROOT'] . '/variables/'.$filenames[$num];
?>
<?php
$atef = array(
'page1',
'page2',
'page3',
);
$atef = $atef [ rand(0, (count($atef)-1)) ];
require($atef.php);
?>