Non so bene quale sia il problema,ma funziona 'tutto' fino a quando non arrivo a $iden,questo è il codice(ho segnato dove c'è l'errore,è nelle prime righe):
Codice PHP:
<?php
include 'dbc.php';
page_protect();
    
$path=$_GET['path'];
if(
$path!='' && $path!='null' && $path!='undefined') {
        
    
$site_name='http://farebury.exofire.net/';
    
    
$path=str_replace($site_name,'',$path);
    
$sept=str_replace('tree/','',$path);
    
$leng=intval(stripos('/',$sept));
    
$iden=substr($sept,$leng); //errore
    
$iden=trim($iden); //errore

    
    /*check if you can delete the folder*/
    
$username=$_SESSION['user_nick'];
    
$usid=$_SESSION['user_id'];
    
    
$perm=$basepermfold.$usid.'/'.$username.'.txt';
    
    
$var implode(''file ($perm));
    
$arrperm=explode("\n",$var);
    
$permissiondelete=false;
    
    for(
$i=0;$i<count($arrperm);$i++){
        if(
$arrperm[$i]==$iden){
            
$permissiondelete=true;
            break;
        }                
    }
    
    
    if(
$permissiondelete==true){
        
/*Folder level*/
        
$query="SELECT `folder_level` FROM `folder` WHERE `idd`='$iden'"
        
$level=mysql_query($query,$link);
        
        
$path=trim($path);
        
$ceckph=str_replace('/','',$path);
        
$ceckph=trim($ceckph);        
    
        
$subfolder '2' ;
        
$mainfolder '1' ;
    
        
$permtxt '/'.$username.'.txt';
    
        if(
$ceckph!='tree'){
            
//elimino file
            
if(is_file($path)==true){
                
unlink($path);    
                echo 
"The file has been deleted";
            }
            
//elimino cartella
        
            //sub folder
            
else if(is_dir($path) && $level==$subfolder){
                
$var implode(''file ($read));
                
$arr=explode("\n",$var);
            
                
$check=delete_directory($path);
             
                if(
$check==true){
                
                    echo 
"The folder and his content has been deleted";         
                }                
                else
                    echo 
"There was a problem,couldn't delete the subfolder,please contact the Administrator"
            }
            
//main folder
            
else if(is_dir($path) && $level==$mainfolder){
                
$read=$path.$infotxt;
                
pulisci($read);
                
$var implode(''file ($read));
                
$arr=explode("\n",$var);
                if(
count($arr)==1){ //only one person
                    
$check=delete_directory($path);             
                    if(
$check==true){
                        
//delete permission
                        
for($i=0;$i<count($arrperm);$i++){
                            if(
$arrperm[$i]==$iden){
                                
$arrperm[$i]='';
                                break;
                            }                
                        }
                        
$file fopen($perm"w+");
                        
fwrite($file,$arrperm."\n");
                        
fclose($file);
                        
pulisci($perm);
                        
$operation="DELETE FROM folder WHERE idd='$iden'";
                        
mysql_query($operation,$link);
                        echo 
"The folder and his content has been deleted";         
                    }                
                    else
                        echo 
"There was a problem,couldn't delete the main folder,please contact the Administrator"
                }
                else{
//more than one person
                    
for($i=0;$i<count($arr);$i++){
                        if(
$arr[$i]==$username){
                            
$arr[$i]='';
                            break;
                        }    
                    }                    
                    
$file fopen($read"w+");
                    
fwrite($file,$arr."\n");
                    
fclose($file);
                    
pulisci($read);
                
                    
//delete permission
                    
for($i=0;$i<count($arrperm);$i++){
                        if(
$arrperm[$i]==$iden){
                            
$arrperm[$i]='';
                            break;
                        }                
                    }
                    
$file fopen($perm"w+");
                    
fwrite($file,$perm."\n");
                    
fclose($file);
                    
pulisci($perm);
                
                }
            }
        
            
//no file or folder
            
else {
                echo 
"There was a problem,couldn't identify the folder type,please contact the Administrator";
            }
        }
        else
            echo 
"You can't delete the Parent Folder.";

    }
    else
        echo 
"You can't delete this folder,because you don't own the permissions.";

}
function 
delete_directory($dirname) {
       if (
is_dir($dirname))
          
$dir_handle opendir($dirname);
       if (!
$dir_handle)
          return 
false;
       while(
$file readdir($dir_handle)) {
          if (
$file != "." && $file != "..") {
             if (!
is_dir($dirname."/".$file))
                
unlink($dirname."/".$file);
             else
                
delete_directory($dirname.'/'.$file);    
          }
       }
       
closedir($dir_handle);
       
rmdir($dirname);
       return 
true;
    }
     

function 
pulisci($store){
$arr=array();
    foreach( 
file($store) as $line ){
            
$line=trim($line);
        if(
$line != ''$arr[]=$line;
        }
    
file_put_contents($storeimplode("\n",$arr) );
}
?>
Qualcuno sa aiutarmi?