WHM that works with an FTP server

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
User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

WHM that works with an FTP server

Post by Trenchant »

I created a online File Manager but I have noticed a very important flaw. When a user uploads a file via FTP the File Manager is not updated. All files in the file manger are recorded in a database(just file names and locations).

How can I fix this? Is there a way to scan for all files/folders in a specific folder?

I'm currently using PHP 4
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

glob ^_^
User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

Post by Trenchant »

how do I find folders with that? I can find files okay now but how do I find folders?

Also, how would I use glob to find the files in a different folder. Something like this?

Code: Select all

glob("/hosting/gibons/www/*.*");
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

hmm.. If unix server with shell access, you could use ls, but other than that I don't know. I think glob accepts wildcards, though. Unless I'm thinking about a time I used grep in an ls shell command. :P
User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

Post by Trenchant »

The script has to work with both Windows and Unix. In the PHP manual is shows examples with glob("*.txt"); and glob("*.*"); but I'm not sure if you can put a dirrectory infront of that. thats all.

I just thought of a way to find folders and files. Although there might be a possible exploit in it. I would just have to find the files without .'s in them. Then check if the name is actually a dirrectory.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

glob can have a directory in front of the pattern...
User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

Post by Trenchant »

feyd wrote:glob can have a directory in front of the pattern...
What about when working with folders and files at the same time? Is there a way for glob to tell you if the result was a file or folder?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

Post by Trenchant »

thanks.
Post Reply