I found this script and everything was working fine. But since I have set it up for multipul users. Now the delete function won't work. I know very little php.
PHP Code:
if ($_REQUEST[del] && $DELETABLE)  {
  
$resource fopen("log.txt","a");
  
fwrite($resource,date("Ymd h:i:s")."DELETE - $_SERVER[REMOTE_ADDR]"."$_REQUEST[del]\n");
  
fclose($resource);
  
  if (
strpos($_REQUEST[del],"/.")>0); 
  else if (
strpos($_REQUEST[del],$upload_dir) === false);
  else if (
substr($_REQUEST[del],0,6)==$upload_dir) {
    
unlink($_REQUEST[del]);
    print 
"<script>window.location.href='$url_this?message=deleted successfully'</script>";
  }

PHP Code:
$upload_dir "userfiles/".$_SESSION['MM_Username']."/";
$upload_url $url_dir."/userfiles/".$_SESSION['MM_Username']."/"