help please!
Date: 08/20/05
(PHP Community) Keywords: php, web, hosting, apache
This is the first time using actual home made php code. I usually would go and just download a script and use it as is. This time using mostly original components of course all source and reference acquired through php.net. Anyways I am having some trouble though. Let me first give you an idea of my directory setup. I have 'web' as my root directory. And I am working in my 'emu' folder. So it all add's up to 'c:/web/emu'. And I am hosting this using apache, and am using a dns redirect service. My url is http://corpsegristle.dynu.com, and I am working on http://corpsegristle.dynu.com/emulation.php. I cannot just put '/emu' as the directory, I have to include '/web/emu' for it to load up the script and find the roms. But the problem relies in it including the "web" in the url. Notice:
http://corpsegristle.dynu.com/web/emu/a/gen/Aero%20Blasters%20Genesis.rar -bad
http://corpsegristle.dynu.com/emu/a/gen/Aero%20Blasters%20Genesis.rar -good
I need to somehow get this to only include "emu" oppose to including the "web" as well. Or maybe I am missing something all together here. I have tried to include the actual url to my site in the directory but that doesn't work. I appologize if this is a "noob" question. Still new to PHP.
";
//lets split it up for the sake of filetype where $ftype[1] will be the filetype
$ftype=explode(".",$files[$a]);
// WE GOT A RAR FILE
if ($ftype[1]=="rar")
{
//If its a rar file, the text file trails it, so make the link for it first
echo "";
//Increment to the next text file
$a++;
//Read it.
$temp=readfile("$dir\\$files[$a]");
//Dump it. end the link.
echo "
";
//Next please.
$a++;
}
//WE GOT A TXT FILE (then a ZIP)
if ($ftype[1]=="txt")
{
//Well obviously, due to the code before, if it wasnt a rar its a txt file preceeding the zip.
//Increment to link the zip
$a++;
echo "";
//Go back for the text file
$a--;
//Read out the text file now
$temp=readfile("$dir\\$files[$a]");
//format it
echo "
";
//Next please.
$a=$a+2;
}
}
//End meat and potatoes
?>
Source: http://www.livejournal.com/community/php/337883.html