";
$filename= basename( $_FILES['uploadedfile']['name']);
runme($target_path);
list_files($target_path2);
}
function list_files($dir)
{
if(is_dir($dir))
{
if($handle = opendir($dir))
{
while(($file = readdir($handle)) !== false)
{
if($file != "." && $file != ".." && $file != "Thumbs.db"/*pesky windows, images..*/)
{
echo ''.$file.'
'."\n";
}
}
closedir($handle);
}
}
}
function runme($files)
{
$myFile = $files;
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
print "Proccessing Now.
";
$ourFileHandle = fopen("$myFile.pwd", 'w') or die("can't open file");
fclose($ourFileHandle);
$wordChunks = explode(",", $theData);$ii=0;
for($i = 0; $i < count($wordChunks); $i++)
{
$ii++;
$wordChunks[$i] = utrim($wordChunks[$i]);
exec("/usr/bin/htpasswd -b $myFile.pwd $wordChunks[$i] $wordChunks[$i]");
echo ".";if ($ii >= 50) { echo "
"; $ii=0;}
}
unlink("$myFile");
echo "
Completed, Please Download Your File:
";
}
function utrim($source)
{
$temp = ltrim($source);
$temp = rtrim($temp);
$temp = trim($temp);
return $temp;
}
?>