This is section of code that I have put in /pgen/admin
<h1><b>List of saved text files:</b></h1>
<?php
$directory = "/pgen/saves/";
$phpfiles = glob($directory . "*.html");
$id = 1;
foreach ($phpfiles as $phpfile) {
$date = " last modified/date created: " . date ("F d Y H:i:s.", filemtime($phpfile));
echo $id.". <a href=$phpfile>".basename($phpfile)."</a>" .$date."<br>";
$id ++;
}
?>
The $directory
variable is supposed to be the root of the webpage plus /pgen/saves/.
I have tried using $_SERVER["DOCUMENT_ROOT"]."/pgen/saves"
.
Also, if I browse using a ftp client, it shows this page is located at /public_html/pgen/admin/
because I am using a 3rd party hosting service.
The code is supposed to list the files in the /pgen/saves
folder but the code itself is in the /pgen/admin
folder. I've searched everywhere and since I'm new at php, I don't know what to do.