Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Need some help with a PHP script...

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

Joey

^_^VIP Member
Impact
26
Hi guys,

I've got a PHP script, it is a directory index. It shows all of the files in the directory, allows me to download, and even allows me to upload files. It's got everything I need, except for the ability to delete files. I would be very appreciative if anyone could add delete functionality to this script.

File is attached.

Thanks,
Joey
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
I can't look at it right now but if anyone wants to try, I think a simple unlink function will do the trick.
 
0
Close
if this is still unresolved when I get back from work this evening I will gladly sort it out for you.
 
0
Close
please post the new script also when u r done :) so that people like me may also benefit from this great script

p.s.: does it support remote upload function?
 
0
Close
Attached as promised. It works and I have ensured people cant bugger about with the file name.

It doesn't look great where the delete link is but it works.
 
0
Close
Thanks Filth I had a bit of a problem deleting files ouside of the root dir, And the regular expression died on the period. I changed the code and seems to work fine.

PHP:
if ($_REQUEST['delete'])
{
	$to_delete = './'.$leadon.$_REQUEST['delete'];
	if (is_file( $to_delete ) AND preg_match('/^[-_0-9a-z]+\.[-_0-9a-z]+$/i',$_REQUEST['delete'])===1)
	{
		unlink($to_delete);
	}
}
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back