Hi folks,
I wrote a script to process the contents of a directory and put it out as a table with links to that files etc.
This works fine when being done on the same server (simple coding, I learned PHP 30 minutes ago and it did).
The prob is: the free hosting service where I can use PHP offers only 25 Megs of Webspace (and only 500 kB for scripts), I have an account at Crosswinds.net where they serve unlimited webspace, but no script hosting.
Is there any way to scan a directory for files via HTTP? (the script hosting service hasn't installed ftp support for PHP).
My code so far looks like this:
<?php
echo "<TABLE>";
echo "<THEAD>";
echo "<TD>Hier öffnen</TD>";
echo "<TD>Neues Fenster</TD>";
echo "<TD>Text ist vom:</TD>";
echo "</THEAD>";
echo "<TBODY>";
$handle = opendir("http://www.crosswinds.net/~reimwerker/contents/texte/");
while($file = readdir($handle)){
if($file != "." && $file != ".."){
echo "<TR>";
echo "<TD>";
$lastpos = strrpos($file, "/");
if(!$lastpos)
$shortfile = $file;
else {
$shortfile = substr($file, $lastpos);
}
$lastpos = strrpos($shortfile, ".");
if($lastpos){
$shortfile = substr($shortfile, 1, $lastpos);
}
echo "<A HREF='$file'>$shortfile</a>";
echo "</TD><TD>";
echo "<A HREF='$file' TARGET='_new'>$shortfile</a>";
echo "</TD><TD>";
$curFileTime = filemtime($file);
echo date("d.m.Y - H:i", $curFileTime);
echo "</TD>";
echo "</TR>";
}
}
closedir($handle);
echo "</TBODY>";
echo "</TABLE>";
echo "</BODY>";
echo "";
?>
Any suggestions?