Files, Folders, all a bit confusing!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Monotoko
Forum Commoner
Posts: 64
Joined: Fri Oct 26, 2007 4:24 pm

Files, Folders, all a bit confusing!

Post 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
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Re: Files, Folders, all a bit confusing!

Post 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!
Monotoko
Forum Commoner
Posts: 64
Joined: Fri Oct 26, 2007 4:24 pm

Re: Files, Folders, all a bit confusing!

Post 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
Post Reply