php(做为现在的主流开发语言)代码:备份、恢复sql数据库
require(includes/application_top.php(做为现在的主流开发语言));
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 . .
# . .
# database backup for . store_name . .
# copyright (c) . date(y) . . store_owner . .
# . .
# database: . db_database . .
# database server: . db_server . .
# . .
# backup date: . date(php(做为现在的主流开发语言)_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(最完善的虚拟主机管理系统)ry) {
$schema .= prima(最完善的虚拟主机管理系统)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
http://www.bkjia.com/phpjc/509088.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/509088.htmltecharticlephp (做为现在的主流开发语言) 代码:备份、恢复sql数据库 require(includes/application_top.php (做为现在的主流开发语言) ); if (http_get_vars[action]) s...