ljzmcm Posted February 8, 2008 Share Posted February 8, 2008 Hey everyone, first post here, trying to hustle to get something solved. Self-taught php, still pretty amateur, and never messed with the unlink function. I've got a basic directory indexing script here, similar to what you would see if there was no index.html,htm,php, etc file in a directory. However, you can incorporate it into pages. I am trying to add a function that will allow me to delete the listed item. Perhaps just a simple text link on the same line. Anyone wanna take this on or add it for me? Thanks a bunch =) <?php unset($dir); if(!empty($HTTP_GET_VARS['dir'])&&!strpos($HTTP_GET_VARS['dir'],'..')&&!strpos($HTTP_GET_VARS['dir'],'\.\.')) { $dir=$HTTP_SERVER_VARS['DOCUMENT_ROOT'].'/'.$HTTP_GET_VARS['dir']; $d=&$HTTP_GET_VARS['dir']; } else { $dir='.'; $d='.'; } clearstatcache(); if($a=@opendir($dir)) { $dir=htmlspecialchars($dir); $d=htmlspecialchars($d); while(false!==($b=readdir($a))) { if(ereg("^\.",$b)) continue; // ignore hidden files echo (is_dir($b))?"<li> <a href=?dir=$d/$b>$b</a>":"<li> <a href=$d/$b>$b</a>"; } closedir($a); } else { echo 'unable to open directory'; } ?> Link to comment https://forums.phpfreaks.com/topic/90005-anyone-familiar-with-unlink-want-to-help/ Share on other sites More sharing options...
ljzmcm Posted February 8, 2008 Author Share Posted February 8, 2008 bump, thanks Link to comment https://forums.phpfreaks.com/topic/90005-anyone-familiar-with-unlink-want-to-help/#findComment-461596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.