2011-11-14, 03:16 AM
<?php
if(!isset($_GET['start'])){
$start1 = 0;
}else{
$start1 = intval($_GET['start']);
}
$host = "localhost";
$user = "root";
$pass = "";
$name = "dbname";
$forumurl = "http://community.mybb.com";
$con = mysql_connect($host, $user, $pass);
mysql_select_db($name, $con);
$query = mysql_query("select * from `mybb_attachments` LIMIT {$start1} , 10");
$rows = $start1;
while($a = mysql_fetch_assoc($query)){
echo "Downloading <a href=\"{$forumurl}/{$a['attachname']}\">{$a['filename']}</a>.........";
$start = time();
system("wget {$forumurl}/uploads/{$a['attachname']} -o {$a['filename']}",$output);
$stop = time();
echo "<font color=\"green\">Finished in ".intval($stop - $start)." seconds</font><br />\n";
++$rows;
}
if($rows == 10){
echo "Waiting...";
echo ' <meta http-equiv="refresh" content="2;url=index.php?start='.intval($start1 + 10).'"> ';
}
?>
it will download all the files to the directory you put this script in. It will not keep the .attach format, but change back to it's original! (If for some reason you want to keep the .attach and keep everything in correct directories remove "-o {$a['filename']}" and put "-x" instead.
Enjoy :p