Archiving old website
This commit is contained in:
parent
52b5d5cd72
commit
12b0d724da
13 changed files with 285 additions and 120 deletions
21
set_background.php
Normal file
21
set_background.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
function scanAllDir($dir) {
|
||||
$result = [];
|
||||
foreach(scandir($dir) as $filename) {
|
||||
if ($filename[0] === '.') continue;
|
||||
$filePath = $dir . '/' . $filename;
|
||||
if (is_dir($filePath)) {
|
||||
foreach (scanAllDir($filePath) as $childFilename) {
|
||||
$result[] = $filename . '/' . $childFilename;
|
||||
}
|
||||
} else {
|
||||
$result[] = $filename;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
$backgrounds = scanAllDir("backgrounds");
|
||||
$chosen_background = $backgrounds[array_rand($backgrounds)];
|
||||
$chosen_background = "backgrounds/" . $chosen_background;
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue