Php (as the mainstream development language) Code: back up and restore the SQL database require (using des/application_top.php (as the mainstream development language); & nbsp; if (& #36; HTTP_GET_VARS [action]) & #123; & nbsp; switch (php (as the mainstream development language) Code: back up and restore SQL databases
Require (replicdes/application_top.php (as the mainstream development language ));
If ($ HTTP_GET_VARS [action]) { Switch ($ HTTP_GET_VARS [action]) { Case forget: Tep_db_query ("delete from". TABLE_CONFIGURATION. "where configuration_key = DB_LAST_RESTORE "); $ MessageStack-> add_session (SUCCESS_LAST_RESTORE_CLEARED, success ); Tep_redirect (tep_href_link (FILENAME_BACKUP )); Break; Case backupnow: Tep_set_time_limit (0 ); $ Schema = # citespa, Open Source E-Commerce Solutions ."". # Http://www.XXXXXX.com </a> ."". #."". # Database Backup For. STORE_NAME ."". # Copyright (c). date (Y)... STORE_OWNER ."". #."". # Database:. DB_DATABASE ."". # Database Server:. DB_SERVER ."". #."". # Backup Date:. date (php (as the mainstream development language) _ DATE_TIME_FORMAT ).""; $ Tables_query = tep_db_query (show tables ); While ($ tables = tep_db_fetch_array ($ tables_query )){ List (, $ table) = each ($ tables ); $ Schema. = drop table if exists. $ table .;."". Create table. $ table .(.""; $ Table_list = array (); $ Fields_query = tep_db_query ("show fields from". $ table ); While ($ fields = tep_db_fetch_array ($ fields_query )){ $ Table_list [] = $ fields [Field]; $ Schema. =. $ fields [Field]... $ fields [Type]; If (strlen ($ fields [Default])> 0) $ schema. = default. $ fields [Default].; If ($ fields [Null]! = YES) $ schema. = not null; If (isset ($ fields [Extra]) $ schema. =. $ fields [Extra]; $ Schema. = ,.""; } $ Schema = ereg_replace (", $", $ schema );
// Add the keys $ Index = array (); $ Keys_query = tep_db_query ("show keys from". $ table ); While ($ keys = tep_db_fetch_array ($ keys_query )){ $ Kname = $ keys [Key_name]; If (! Isset ($ index [$ kname]) { $ Index [$ kname] = array (unique =>! $ Keys [Non_unique], Columns => array ()); } $ Index [$ kname] [columns] [] = $ keys [Column_name]; } While (list ($ kname, $ info) = each ($ index )){ $ Schema. = ,.""; $ Columns = implode ($ info [columns],); If ($ kname = Prima (the most comprehensive VM Management System) RY ){ $ Schema. = Prima (the most comprehensive VM Management System) ry key (. $ columns .); } Elseif ($ info [unique]) { $ Schema. = UNIQUE. $ kname. (. $ columns .); } Else { $ Schema. = KEY. $ kname. (. $ columns .); } } $ Schema. = "".);."";
// Dump the data $ Rows_query = tep_db_query ("select". implode (, $ table_list). "from". $ table ); While ($ rows = tep_db_fetch_array ($ rows_query )){ $ Schema_insert = insert into. $ table. (. I |