[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 12-20-2006, 04:02 PM   #1 (permalink)
^_^
 
Joey's Avatar
 
Join Date: May 2005
Location: Maryland
Posts: 980
109.90 NP$ (Donate)

Joey is a name known to allJoey is a name known to allJoey is a name known to allJoey is a name known to allJoey is a name known to allJoey is a name known to all


Help! Need some help with a PHP script...

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
Joey is offline  
Old 12-20-2006, 04:31 PM   #2 (permalink)
Senior Member
 
Crusader's Avatar
 
Join Date: Aug 2003
Location: Canada
Posts: 1,293
1,264.40 NP$ (Donate)

Crusader is just really niceCrusader is just really niceCrusader is just really niceCrusader is just really nice


I can't look at it right now but if anyone wants to try, I think a simple unlink function will do the trick.
__________________

Near Fantastica
| Matthew Good - Vancouver
>> Do you Frawlik? <<
Crusader is offline  
Old 12-20-2006, 10:39 PM   #3 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute

Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
if this is still unresolved when I get back from work this evening I will gladly sort it out for you.
Peter is offline  
Old 12-21-2006, 04:10 AM   #4 (permalink)
Senior Member
 
champ_rock's Avatar
 
Join Date: Oct 2006
Location: http://akshayjain.org
Posts: 2,768
8,037.05 NP$ (Donate)

champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute


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?
__________________
Akshay Jain
......................
champ_rock is offline  
Old 12-21-2006, 01:08 PM   #5 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute

Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
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.
Attached Files
File Type: zip Script.zip (20.0 KB, 6 views)
Peter is offline  
Old 12-21-2006, 01:36 PM   #6 (permalink)
NamePros Regular
 
baxter's Avatar
 
Join Date: Apr 2006
Posts: 289
1,990.00 NP$ (Donate)

baxter is a jewel in the roughbaxter is a jewel in the roughbaxter is a jewel in the rough

Ethan Allen Fund Save The Children
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 Code:
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);
    }
}
__________________
Chimps.ca - Swans.ca - Snails.ca
baxter is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 10:10 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85