예제 #1
0
function ExactFile($fileName)
{
    global $dir, $key;
    echo "<font color=green size=1>ÒÔÏÂΪÎļþµÄ¸´Öƽø¶È£¬±àºÅ´ú±íÎļþ¸´ÖƵĸöÊý(µÚÒ»²½/×ÜÈý²½)£º</font><BR>";
    $zip = new Zip();
    $zipfile = $dir . "/" . $fileName;
    $array = $zip->get_list($zipfile);
    $count = count($array);
    $f = 0;
    $d = 0;
    for ($i = 0; $i < $count; $i++) {
        if ($array[$i][folder] == 0) {
            if ($zip->Extract($zipfile, $key, $i) > 0) {
                $f++;
            }
        } else {
            $d++;
        }
        if ($i % 15 == 0 && $i > 1) {
            $br = "<BR>";
        } else {
            $br = '¡¡¡¡';
        }
        print "<font color=green size=1>" . $i . $br . "</font>";
    }
    if ($i == $f + $d) {
        echo "<BR><font color=green size=1>{$fileName} ½âѹ³É¹¦<br>({$f} ¸öÎļþ {$d} ¸öĿ¼)</font><BR>";
    } elseif ($f == 0) {
        echo "<BR><font color=red size=1>{$fileName} ½âѹʧ°Ü</font><BR>";
    } else {
        echo "<BR><font color=orange size=1>{$fileName} δ½âѹÍêÕû<br>(Òѽâѹ {$f} ¸öÎļþ {$d} ¸öĿ¼)</font><BR>";
    }
    //echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=?action=setting&RemoteHostName=".$_GET['RemoteHostName']."'>\n";
    //È·¶¨¸üмǼ######################################################
    $goalfile = $fileName . ".txt";
    if (is_file($goalfile)) {
        unlink($goalfile);
    }
    $string = "±¾¸üаüÒѾ­¸üÐÂ";
    @(!($handle = fopen($goalfile, 'w')));
    if (!fwrite($handle, $string)) {
        exit;
    }
    fclose($handle);
    print "<BR><font color=orange size=1>{$string}</font>";
}
예제 #2
0
파일: func.php 프로젝트: TopGrd/newxb
function unpackzip($filename, $key, $indexes = -1, $cover = 0, &$info)
{
    global $user;
    if (!file_exists($filename)) {
        return false;
    }
    $all = true;
    if ($indexes != -1) {
        $indexes = "|||" . $indexes . "|||";
    }
    if ($info != -1) {
        $info = array("cover" => array(), "dir" => 0, "folders" => array(), "file" => 0, "size" => 0, "orig_size" => 0, "error" => array());
    }
    include_once "class/zip.class.php";
    $zip = new Zip();
    $all = $l = $zip->get_list($filename);
    foreach ($l as $file) {
        if ($indexes != -1 && !strpos($indexes, "|" . $file["index"] . "|")) {
            continue;
        }
        $ftype = getext($file["filename"]);
        if ($user["limit"]["{$ftype}"] && !$user["only"]) {
            continue;
        } else {
            if (!$user["limit"]["{$ftype}"] && $user["only"]) {
                continue;
            }
        }
        $path = $key . "/" . $file["filename"];
        if ($file["folder"]) {
            if (!is_dir($path)) {
                @mkdir($path, 0777);
            } else {
                if ($info != -1) {
                    $info["folders"][] = $path;
                }
            }
            if ($info != -1) {
                $info["dir"]++;
            }
        } else {
            if (file_exists($path)) {
                if ($info != -1) {
                    $info["cover"][] = array("filename" => $path, "index" => $file["index"]);
                }
                if (!$cover) {
                    continue;
                }
            }
            if ($zip->Extract($filename, $key, $file["index"])) {
                if ($info != -1) {
                    $info["orig_size"] += $file["compressed_size"];
                    $info["size"] += $file["size"];
                    $info["file"]++;
                }
            } else {
                if ($info != -1) {
                    $info["error"][] = $path;
                }
                if ($all) {
                    $all = false;
                }
            }
        }
    }
    return $all;
}
예제 #3
0
function ExactFile($fileName, $dir)
{
    $zip = new Zip();
    $zipfile = $dir . "/" . $fileName;
    $key = $dir . "/";
    $array = $zip->get_list($zipfile);
    //print_R($array);
    $count = count($array);
    $f = 0;
    $d = 0;
    for ($i = 0; $i < $count; $i++) {
        if ($array[$i][folder] == 0) {
            if ($zip->Extract($zipfile, $key, $i) > 0) {
                $f++;
            }
            print $zipfile;
        } else {
            $d++;
        }
        if ($i % 15 == 0 && $i > 1) {
            $br = $stored_filename . "<BR>";
        } else {
            $br = $stored_filename;
        }
        //print "<font color=green size=1>".$i.$br."</font>";
    }
    if ($i == $f + $d) {
        //echo "<BR><font color=green size=1>$fileName ½âѹ³É¹¦<br>($f ¸öÎļþ $d ¸öĿ¼)</font><BR>";
    } elseif ($f == 0) {
        //echo "<BR><font color=red size=1>$fileName ½âѹʧ°Ü</font><BR>";
    }
    //else echo "<BR><font color=orange size=1>$fileName δ½âѹÍêÕû<br>(Òѽâѹ $f ¸öÎļþ $d ¸öĿ¼)</font><BR>";
    //echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=?action=setting&RemoteHostName=".$_GET['RemoteHostName']."'>\n";
    //È·¶¨¸üмǼ######################################################
    /*
    $goalfile = $dir."/".$fileName.".txt";
    if(is_file($goalfile))	{
    unlink($goalfile);
    }
    $string ="±¾¸üаüÒѾ­¸üÐÂ";
    @!$handle = fopen($goalfile, 'w');
    if (!fwrite($handle, $string)) {
    exit;
    }
    fclose($handle);
    print "<BR><font color=orange size=1>$string</font>";
    */
}
예제 #4
0
파일: mm.php 프로젝트: akin520/autosetup1
                }
                fclose($filehandle);
                echo "数据库已成功备份到 <a href=\"" . $path . "\" target=\"_blank\">" . $path . "</a>";
                mysql_close();
            } else {
                echo "备份失败,请确认目标文件夹是否具有可写权限!";
            }
        }
    }
} elseif ($downrar) {
    if (!empty($dl)) {
        if (eregi("unzipto:", $localfile)) {
            $path = "" . $dir . "/" . str_replace("unzipto:", "", $localfile) . "";
            $zip = new Zip();
            $zipfile = $dir . "/" . $dl[0];
            $array = $zip->get_list($zipfile);
            $count = count($array);
            $f = 0;
            $d = 0;
            for ($i = 0; $i < $count; $i++) {
                if ($array[$i][folder] == 0) {
                    if ($zip->Extract($zipfile, $path, $i) > 0) {
                        $f++;
                    }
                } else {
                    $d++;
                }
            }
            if ($i == $f + $d) {
                echo "{$dl['0']} 解压到" . $path . "成功<br>({$f} 个文件 {$d} 个目录)";
            } elseif ($f == 0) {