require_once 'common.php';
if(!isset($_POST['act'])) $_POST['act'] = "";
if(!isset($_POST['pw'])) $_POST['pw'] = "";
$err = "";
if($_POST['act']=="login"){
if($_POST['pw']!=KANRIPW){
$err.= "PWが誤っています
";
}else{
$sql ="select * from ".SYS_DB." where code='DUMP_HISTORY'";
$result = mysqli_query($LINKID,$sql);
if($result == FALSE) Error(mysqli_error($result));
if(!mysqli_num_rows($result)){
$sql ="insert ".SYS_DB." set";
$sql.= " code='DUMP_HISTORY'";
$sql.= ", value='0,5,".date("Y-m-d")."'";
$sql.= ", comment='DB_DUMP history(now,max,last_date)'";
$res = mysqli_query($LINKID,$sql);
if($res == FALSE) Error(mysqli_error($res));
$p = array("0","5","");
}else{
$SYS = mysqli_fetch_array($result);
$p = explode(",",$SYS['value']);
}
if($p[2] < date("Y/m/d")){
$p[0]++;
if($p[0] > $p[1]) $p[0] = 0;
//DB DUMP
// show tables
$tbl = array();
$fh = fopen("dbdump/DB_show_tables.txt", 'w');
$sql = "show tables;";
$result = mysqli_query($LINKID,$sql);
if($result == FALSE) Error(mysqli_error($LINKID));
$c = 0;
while($row = mysqli_fetch_array($result)) {
$c++;
fputs($fh,$row[0]."\n");
$tbl[] = $row[0];
}
fflush($fh);
fclose($fh);
chmod("dbdump/DB_show_tables.txt", 0666);
// show columns
$fh = fopen("dbdump/DB_show_columns.txt", 'w');
foreach($tbl as $db){
$sql = "show columns from ".$db.";";
$result = mysqli_query($LINKID,$sql);
if($result == FALSE) Error(mysqli_error($LINKID));
while($row = mysqli_fetch_row($result)) {
$w = $db."\t";
for($j=0;$j","\n",DB_DUMP($db,$LINKID));
fputs($fh,$w);
}
fflush($fh);
fclose($fh);
chmod("dbdump/DB_dump_result.txt", 0666);
// 圧縮(zip)
@unlink("./backup/".$p[0].".zip");
// system("/usr/local/bin/zip -qr ./backup/".$p[0].".zip ./dbdump/*.*");
// system("/usr/local/bin/zip -qr ./backup/".$p[0].".zip ./dic/*.*");
// system("/usr/local/bin/zip -qr ./backup/".$p[0].".zip ./wrd/*.*");
system("/usr/bin/zip -qr ./backup/".$p[0].".zip ./dbdump/*.*");
system("/usr/bin/zip -qr ./backup/".$p[0].".zip ./dic/*.*");
system("/usr/bin/zip -qr ./backup/".$p[0].".zip ./wrd/*.*");
chmod("backup/".$p[0].".zip", 0666);
// SYS_update
$sql ="update ".SYS_DB." set";
$sql.= " value='".$p[0].",5,".date("Y/m/d")."'";
$sql.= " where code='DUMP_HISTORY'";
$result = mysqli_query($LINKID,$sql);
if($result == FALSE) Error(mysqli_error($result));
}
require_once 'menu.php';
exit;
}
}
?>
>
管理者パスワード入力画面
ここは管理者専用の入り口になります
一般の方は先へ進めませんのでお戻り下さい
日替わり時にバックアップ処理を実行するので
ログインに多少時間が掛かる場合があります。