Dynadot โ€” .com Registration $8.99

Need some help with a PHP script...

Spaceship Spaceship
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
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
•••
if this is still unresolved when I get back from work this evening I will gladly sort it out for you.
 
0
•••
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
•••
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
•••
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
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back