Page 1 of 1

Files, Folders, all a bit confusing!

Posted: Thu Aug 13, 2009 7:46 am
by Monotoko
I have a little bit of a problem in that i cannot figure out how to create this function. I have a hosting account with over 1000 domains attatched to it
one of them is a forum hosting company i own, which takes up about 200 of those domains with forums.

this script is going to be stored in:
/home/monotoko/public_html/danzaforums.com

what i want it to do is go into: /home/monotoko/public_html
then go into every folder and look for forum.txt

if it has forum.txt, i would then like the script to read it

an example, http://www.thedomainname.com is stored in the folder thefoldername, and has a forum.php file, in it is:

Code: Select all

<?php
$domain="www.thedomainname.com";
?>
what i would like the script to do is make a list like this:

Code: Select all

http://www.thedomainname.com is stored in /home/monotoko/public_html/thefoldername

Re: Files, Folders, all a bit confusing!

Posted: Thu Aug 13, 2009 9:00 am
by SidewinderX
1. Create a recursive function to read the contents of a directory using http://us2.php.net/manual/en/function.opendir.php. There should be one written by feyd floating around in the snippets forum.

2. Open the file using fopen(), and read the file using fread() (don't forget the close the file using fclose)

If there is anything specific you need help with, be sure to let us know!

Re: Files, Folders, all a bit confusing!

Posted: Thu Aug 13, 2009 6:05 pm
by Monotoko
Thank you very much! That has certainly been a push in the right direction :)
I shall report back on whether i get this script working, and whether i have any problems