هاك أخذ وإسترجاع نسخة من قاعدة البيانات بسهولة
والله من فترة شفت هاك بالشركة وأعجبني مرررررررررررة وهو يصغر القاعدة بشكل رهيب أنا قاعدة بياناتي حجمها 15ميجا بهالهاك صارت 2ميجا وشوي
بسم الله نبدأ الطريقة
1- أفتح ملف admin/template.php
أبحث عن
cpfooter();
?>
قبل هذا أضف
/######### MySQL Database Backup/Restore Hack Ver. 1.0 ###########
//######### by Birdie501 ###########
//######### Variable, please modify ###########
$db_host="Host-name";
$db_username="mysql-username";
$db_passwort="mysql-passwort";
$db_name="database-name";
$pfad="root/your folder to your forum/admin/backup"; // root without / at the end
// If you don't know the root, just upload root.php on your server and call it!
$download_url="http://"; // http://... with / at the end
$dateiname=date('U'); // not to change!. Unique filename will be used
//######### please do not modify lines below ###########
// ###################### Start Backup #######################
if ($action=="backup") {
doformheader("template","dobackup");
makehiddencode("templateid",$templateid);
makehiddencode("group",$group);
maketableheader("Confirm backup");
makedescription("Are you sure you want to backup your mysql database?");
doformfooter("Yes","",2,"No");
}
// ###################### Start Dobackup #######################
if ($HTTP_POST_VARS['action']=="dobackup") {
$programm="mysqldump";
$parameter=" -l --add-drop-table -h ".$db_host." -u".$db_username." -p".$db_passwort." ".$db_name." 2>".$pfad."/error.txt >".$pfad."/".$dateiname.".sql";
echo("<b>Start MySQL Dump:</b> \n");
exec($programm . " " . $parameter, $lines, $result);
echo("done!<br>\n");
echo("<b>compress file:</b> \n");
exec("gzip -c ".$pfad."/".$dateiname.".sql > ".$pfad."/".$dateiname.".sql.gz", $lines, $result);
echo("done!<br>\n");
echo("<b>delete not compressed file:</b> \n");
exec("rm ".$pfad."/".$dateiname.".sql", $lines, $result);
echo("done! \n");
echo("<b><br>Before you can restore this file, you have to rename to backp.sql.gz:</b> \n");
echo("<p>\n");
echo("<a href=\"".$download_url.$dateiname.".sql.gz\" target=\"_blank\">Download File</a>");
}
// ###################### Start Restore #######################
if ($action=="backup") {
doformheader("template","dorestore");
makehiddencode("templateid",$templateid);
makehiddencode("group",$group);
maketableheader("Confirm restore");
makedescription("Are you sure you want to restore your mysql database? <font color='red'>Attention: All datas will be overwritten!</font>");
doformfooter("Yes","",2,"No");
}
// ###################### Start Dorestore #######################
if ($HTTP_POST_VARS['action']=="dorestore") {
if(file_exists($pfad."/backup.sql.gz")==1):
$programm="mysql";
$parameter="--host=".$db_host." --user=".$db_username." --password=".$db_passwort." --database=".$db_name." <".$pfad."/backup.sql";
echo("<b>decompress backup:</b> \n");
exec("cd ".$pfad, $lines, $result);
exec("gzip -d ".$pfad."/backup.sql.gz", $lines, $result);
echo("done!<br>\n");
echo("<b>restore file to database:</b> \n");
exec($programm." ".$parameter, $lines, $result);
echo("done!<br>\n");
else:
echo("<b>File <font color='red'>".$pfad."/backup.sql.gz</font> not found!</b> \n");
endif;
}
//######### End of MySQL Database Backup/Restore Hack Ver. 1.0 ###########
//######### by Birdie501 ###########