PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

PHP Scripting Needed

Anyone here up for a hopefully small PHP scripting task? (Miracle? :P)

Basically need a script that'll take a directory full of files with names in a certain format, and put them into a table with several columns, with a link to download the file being the last one.

Hell, if someone can get me started with something basic, I can probably expand it and otherwise hack it to my needs.

Basically it's:

MapName[Class.WW or NW]Time(Name).dm_83
Do you know some basic PHP? The directory functions aren't really that hard if you look them up. I could probably write it in 20 or so mins, but I feel too lazy ATM.
Not done PHP for years, but I'd look at:

<a href="http://lu.php.net/manual/en/function.scandir.php">scandir</a> for getting the contents of the directory, then
<a href="http://lu.php.net/manual/en/function.preg-split.php">preg-split</a> to split the filename into "columns".

Personally I'd then store that data within a database (along with the filename/URL) rather than hitting a directory list every time.
damian: It's something I could probably hack my way through given something basic, though from scratch it's a different story.

refractor: Could I still get real-time changes if I went with a database? I just wanted it so the demos can be uploaded and appear on the page.

Thanks for those 2 functions though, I might just take a crack at doing this myself too.
Awesome, got it working:
http://d8d.org/etfspeed/captures.php

Used preg_match instead of preg_split, as I could then just do $matches[1] through 5.