Exemple #1
0
        $bk['num'] = substr($file, $strlen, strrpos($file, '.') - $strlen);
        $filedb[] = $bk;
    }
}
//导入备份文件
$operation = get_argg('operation');
if ($operation == 'bakin') {
    $is_check = check_rights("g04");
    if (!$is_check) {
        echo $m_langpackage->m_no_pri;
        exit;
    }
    $dbo = new dbex();
    dbtarget('w', $dbServs);
    $pre = get_argg('pre');
    bakindata($dbo, '../docs/' . $pre . '_1.sql');
    echo "<script language='javascript'> alert('{$d_langpackage->d_lead_suc}'); location.href='database.save.php'; </script>";
}
//删除备份文件
$fid = get_argg('fid');
if ($fid) {
    $is_check = check_rights("g05");
    if (!$is_check) {
        echo $m_langpackage->m_no_pri;
        exit;
    }
    $file_pre = $fid . "_1.sql";
    delfile('../docs/' . $file_pre);
    echo "{$d_langpackage->d_del_suc}";
    exit;
}
Exemple #2
0
            case 2:
                emDirect('./data.php?error_d=1');
                break;
            case 3:
                emDirect('./data.php?error_c=1');
                break;
        }
        $sqlfile['tmp_name'] = dirname($sqlfile['tmp_name']) . '/' . str_replace('.zip', '.sql', $sqlfile['name']);
        if (!file_exists($sqlfile['tmp_name'])) {
            emMsg('只能导入emlog备份的压缩包,且不能修改压缩包文件名!');
        }
    } elseif (getFileSuffix($sqlfile['name']) != 'sql') {
        emMsg('只能导入emlog备份的SQL文件');
    }
    checkSqlFileInfo($sqlfile['tmp_name']);
    bakindata($sqlfile['tmp_name']);
    $CACHE->updateCache();
    emDirect('./data.php?active_import=1');
}
if ($action == 'dell_all_bak') {
    if (!isset($_POST['bak'])) {
        emDirect('./data.php?error_a=1');
    } else {
        foreach ($_POST['bak'] as $val) {
            unlink($val);
        }
        emDirect('./data.php?active_del=1');
    }
}
/**
 * 检查备份文件头信息
Exemple #3
0
     InitGP(array('step', 'count', 'pre'));
     if (!$count) {
         $count = 0;
         $handle = opendir(D_P . 'data');
         while ($file = readdir($handle)) {
             if (eregi("^{$pre}", $file) && eregi("\\.sql\$", $file)) {
                 $count++;
             }
         }
     }
     !$step && ($step = 1);
     /*
     $sql=readover(D_P.'data/'.$pre.$step.'.sql');
     bakindata($sql);
     */
     bakindata(D_P . 'data/' . $pre . $step . '.sql');
     $i = $step;
     $step++;
     if ($count > 1 && $step <= $count) {
         $j_url = "{$basename}&action=bakin&step={$step}&count={$count}&pre={$pre}";
         adminmsg('bakup_in', EncodeUrl($j_url), 2);
     }
     updatecache();
     adminmsg('operate_success');
 } elseif ($action == 'del') {
     InitGP(array('delfile'), 'P');
     if (!$delfile) {
         adminmsg('operate_error');
     }
     foreach ($delfile as $key => $value) {
         if (eregi("\\.sql\$", $value)) {
        break;
    case 'bakin':
        $step = $_GET['step'];
        $count = $_GET['count'];
        $pre = $_GET['pre'];
        if (!$count) {
            $count = 0;
            $handle = opendir(iPATH . 'admin/data');
            while ($file = readdir($handle)) {
                if (eregi("^{$pre}", $file) && eregi("\\.sql\$", $file)) {
                    $count++;
                }
            }
        }
        !$step && ($step = 1);
        bakindata(iPATH . 'admin/data/' . $pre . $step . '.sql');
        $i = $step;
        $step++;
        if ($count > 1 && $step <= $count) {
            redirect("正在导入第{$i}卷备份文件,程序将自动导入余下备份文件...", __SELF__ . "?do=database&operation=bakin&step={$step}&count={$count}&pre={$pre}", 3);
        } else {
            redirect("导入成功!", __SELF__ . "?do=database&operation=recover");
        }
        break;
}
function num_rand($lenth)
{
    mt_srand((double) microtime() * 1000000);
    for ($i = 0; $i < $lenth; $i++) {
        $randval .= mt_rand(0, 9);
    }
Exemple #5
0
         while (($file = readdir($handle)) !== false) {
             if (preg_match("/^{$pre}/i", $file) && preg_match("/\\.sql\$/i", $file)) {
                 $count++;
             }
         }
     } elseif ($isdir && !$count) {
         $count = 1;
         $handle = opendir($bakupDir . $pre);
         while (($file = readdir($handle)) !== false) {
             if (preg_match("/^{$pre}\\_\\d+\\.(sql|zip)\$/i", $file)) {
                 $count++;
             }
         }
     }
     !$step && ($step = 1);
     !$isdir ? bakindata($bakupDir . $pre . $step . '.sql') : newBakinData($pre, $step);
     $i = $step;
     $step++;
     if ($count > 1 && $step <= $count) {
         $j_url = "{$basename}&action=bakin&step={$step}&count={$count}&pre={$pre}&isdir={$isdir}";
         adminmsg('bakup_in', EncodeUrl($j_url), 2);
     }
     updatecache();
     extract(pwCache::getData(D_P . 'data/bbscache/config.php', false));
     adminmsg('operate_success');
 } elseif ($action == 'del') {
     S::gp(array('delfile', 'issub'), 'P');
     !S::isArray($delfile) && adminmsg('operate_error');
     foreach ($delfile as $key => $value) {
         $value = Pcv($value);
         if (!$value) {