Ho una pagina php che elenca il contenuto di una cartella (in genere sono foto).

Devo aggiungere una funzione per eliminarle in maniera selettiva.

Codice PHP:
<?php
    
    
// ----------------------
    // Image Upload Functions
    // ----------------------
    
    
function image_list () {
        
// Get a list of images in the image folder. Return HTML.
        //
        
        
if (!file_exists(IMAGES_DIR)) {
            
$oldumask umask(0);
            
$ok mkdir(IMAGES_DIR0777 );
            
umask($oldumask);
        }
        
        
// Changed this to only display Image files. This function
        // is used in comment.php if the blog owner has img tag
        // enabled for comments.
        
$dir IMAGES_DIR;
        
$contents sb_folder_listing$dir, array( '.jpg''.jpeg''.gif''.png' ) );
        
// $contents = sb_folder_listing( $dir, array() );
        
        
$str NULL;
        if (
$contents) {
            for ( 
$i 0$i count$contents ); $i++ ) {
                
$str  .= '[url='.$dir.$contents[$i].']'.$contents[$i].'[/url]
'
;
            }
        }
        
        return ( 
$str );
    }
?>