I have this script i found on here. I modified it so i dont have to place it in each of my members folders where i jut do a
?user_id =user.
Well right now i can only get it to delete only one file at a time. I want it to do it's job and delete all the files checked. Can some one check the script for me and tell me what i am doing wrong.
<?
session_start();
$login = $HTTP_SESSION_VARS['_amember_user']['login'];
?>
<html>
<head>
<title><? echo $login; ?>'s File Management</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#AFC0D0" text="#000000">
<FORM ENCTYPE="multipart/form-data" ACTION="<? $PHP_SELF ?>" METHOD="POST">
<?php
$file_array = array();
function GetDirArray($sPath)
{
global $file_array;
$handle=opendir($sPath);
$i=0;
while (false!==($file = readdir($handle)))
{
if ($file != "." && $file != ".." &&
(strtolower(substr($file,-3))=='jpg' || strtolower(substr($file,-3))=='png' || strtolower(substr($file,-3))=='jar' || strtolower(substr($file,-3))=='jad' || strtolower(substr($file,-3))=='mid' || strtolower(substr($file,-3))=='qcp' || strtolower(substr($file,-3))=='cmx' || strtolower(substr($file,-3))=='pmd' || strtolower(substr($file,-3))=='jpe' || strtolower(substr($file,-3))=='gcd'))
{
$file_array[]= $file;
$i++;
}
}
closedir($handle);
sort($file_array);
}
$sPath= dirname($PATH_TRANSLATED)."/$login/";
GetDirArray($sPath);
if(isset($delete))
{
print "Now deleting..";
$num = count($file_array);
for($i=0;$i<$num;$i++)
{
if(isset($checkbox_file[$i]))
{
$filename = $file_array[$i];
unlink($login."/".$file_array[$i]);
print "Deleting $filename..";
exit;
}
}
}
else
{
$num = count($file_array);
for($i=0;$i<$num;$i++)
{
print "<INPUT TYPE=checkbox NAME=\"checkbox_file[$i]\" value=\"$i\">$file_array[$i]<br>\n";
}
}
?>