当前位置: 网学 > 编程文档 > PHP > 正文

PHP网站备份程序代码分享

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/06/22

以下是网学网为您推荐的PHP-PHP网站备份程序代码分享,希望本篇文章对您学习有所帮助。

效果图:

PHP代码
复制代码 代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站程序备份</title>
</head>
<body>
<form name="myform" method="post" action="">
<?php
error_reporting(E_ALL & ~E_NOTICE);
ini_set(''memory_limit'', ''2048M'');
echo "选择要压缩的文件或目录:<br>";
$fdir = opendir(''./'');
while($file=readdir($fdir))
{
if($file==''.''|| $file==''..'')
continue;
echo "<input name=''dfile[]'' type=''checkbox'' value=''$file'' ".($file==basename(__FILE__)?"":"checked")."> ";
if(is_file($file))
{
echo "<font face=\"wingdings\" size=\"5\">2</font> $file<br>";
}
else
{
echo "<font face=\"wingdings\" size=\"5\">0</font> $file<br>";
}
}
?>
<br>
包含下列文件类型:
<input name="file_type" type="text" id="file_type" value="" size="50">
<font color="red">
(文件类型用"|"隔开,默认空则包含任意文件,例:如果需要打包php和jpg文件,则输入"php|jpg")
</font>
<br>
压缩文件保存到目录:
<input name="todir" type="text" id="todir" value="__dwb2011__" size="15">
<font color="red">
(留空为本目录,必须有写入权限)
</font>
<br>
压缩文件名称:
<input name="zipname" type="text" id="zipname" value="dwb2011.zip" size="15">
<font color="red">
(.zip)
</font>
<br>
<br>
<input name="myaction" type="hidden" id="myaction" value="dozip">
<input type=''button'' value=''反选'' onclick=''selrev();''>
<input type="submit" name="Submit" value=" 开始压缩 ">
<script language=''javascript''>
function selrev()
{
with(document.myform)
{
for(i=0;i<elements.length;i++)
{
thiselm = elements[i];
if(thiselm.name.match(/dfile\[]/))
thiselm.checked = !thiselm.checked;
}
}
}
</script>
<?php
error_reporting(E_ALL & ~E_NOTICE);
set_time_limit(0);
class PHPzip
{
var $file_count = 0 ;
var $datastr_len = 0;
var $dirstr_len = 0;
var $filedata = ''''; //该变量只被类外部程序访问
var $gzfilename;
var $fp;
var $dirstr='''';
var $filefilters = array();
function SetFileFilter($filetype)
{
$this->filefilters = explode(''|'',$filetype);
}
//返回文件的修改时间格式.
//只为本类内部函数调用.
function unix2DosTime($unixtime = 0)
{
$timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
if ($timearray[''year''] < 1980)
{
$timearray[''year''] = 1980;
$timearray[''mon''] = 1;
$timearray[''mday''] = 1;
$timearray[''hours''] = 0;
$timearray[''minutes''] = 0;
$timearray[''seconds''] = 0;
}
return (($timearray[''year''] - 1980) << 25) | ($timearray[''mon''] << 21) | ($timearray[''mday''] << 16) | ($timearray[''hours''] << 11) | ($timearray[''minutes''] << 5) | ($timearray[''seconds''] >> 1);
}
//初始化文件,建立文件目录,
//并返回文件的写入权限.
function startfile($path = ''dodo.zip'')
{
$this->gzfilename=$path;
$mypathdir=array();
do
{
$mypathdir[] = $path = dirname($path);
} while($path != ''.'');
@end($mypathdi

网学推荐

免费论文

原创论文

浏览:
设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
湘ICP备09003080号