Need some help with a PHP script...

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
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
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back