function restore($dir, $filename) { require_once 'DbManage.php'; $db = new DBManage('localhost', 'root', '', 'jianji02test', 'utf8'); // 参数:备份哪个表(可选),备份目录(可选,默认为backup),分卷大小(可选,默认2048,即2M) $db->restore('./' . $dir . '/' . $filename . '_v1.sql'); }
} .dbDebug b{ color: #06f; font-weight: normal; } .dbDebug .imp{ color: #f06; } </style> </head> <body> <?php /** * Created by yanue. * User: yansueh * Date: 12-10-27 * Time: 上午11:24 * To change this template use File | Settings | File Templates. */ require 'DbManage.class.php'; //------1. 数据库备份(导出)------------------------------------------------------------ //分别是主机,用户名,密码,数据库名,数据库编码 $db = new DBManage('localhost', 'root', '', 'eda', 'utf8'); // 参数:备份哪个表(可选),备份目录(可选,默认为backup),分卷大小(可选,默认2048,即2M) //$db->backup ('','',''); $db->restore('./backup/20121027194215_all_v1.sql'); ?> </body> </html>
\t'RBAC_USER_TABLE' =>'{$db_prefix}role_user', \t'RBAC_ACCESS_TABLE' =>'{$db_prefix}access', \t'RBAC_NODE_TABLE' =>'{$db_prefix}node', \t'SHOW_PAGE_TRACE'=>false,//显示调试信息 \t'APP_AUTOLOAD_PATH' => '@.TagLib',//自动加载类 //分页设置 \t 'VAR_PAGE'=>'p', //系统相关的信息,安装时要写入 \t'SYS_NAME'=>'盘古信息化管理平台', \t'VERSION'=>'1.0', \t'INSTALL_DATE'=>'{$date}', ); ?> EOF; file_put_contents("../Conf/config.php", $config); file_put_contents("../lock.txt", $date . '系统安装完成'); $index = <<<EOF <?php define('APP_NAME', 'Index'); define('APP_PATH', './'); require( "./ThinkPHP3.1/ThinkPHP.php"); EOF; file_put_contents("../index.php", $index); //导入数据库 include 'dbclass.php'; $db = new DBManage('localhost', $db_user, $db_pwd, $db_name, 'utf8'); $db->restore('pangu.sql'); echo '安装成功,请点这里<a href="../index.php">登录</a>'; } else { include '../Tpl/Index/install.html'; }
$tablenames[] = $table_name; } include 'form.html.php'; // if (isset($_GET['backup'])) $db = new DBManage('mysql1.cs.clemson.edu', 'admin662', '662admin', 'My662Project', 'utf8'); if (isset($_POST['action']) and $_POST['action'] == 'backup') { //------1. database backup------------------------------------------------------------ //The values below are host address, username, password, name of database, charset respectively $db->backup($_POST['tablename'], '', ''); echo $_POST['tablename']; //header('Location: ./index.php'); } // if (isset($_GET['restore'])) foreach ($files1 as &$file1) { if (isset($_POST['action']) and $_POST['action'] == $file1) { //The values below are host address, username, password, name of database, charset respectively //$db->backup ('','',''); $db->restore('./backup/' . $file1); } } break; default: echo "you have no access to this page"; break; } ?> </body> </html>