21,893
社区成员




<html>
<head>
<script>
var $=function(s){return(typeof s=="object")?s:document.getElementById(s);};
function ck(obj)
{
if(obj.value.length>0){
var af="zip";
if (window.navigator.userAgent.indexOf("MSIE")>=1)
{
if(eval("with(obj.value)if(!/"+af.split(",")+"/ig.test(substring(lastIndexOf('.')+1,length)))1;")){alert("上传的文件类型只能为:\n"+af);
obj.createTextRange().execCommand('delete')};
}else if(window.navigator.userAgent.indexOf("Firefox")>=1){
if(eval("with(obj.value)if(!/"+af.split(",")+"/ig.test(substring(lastIndexOf('.')+1,length)))1;")){
alert("上传的文件类型只能为:\n"+af);
Upload.clear("path");
return false;
}
}
}
}
function ts(){
var obj = $("path");
if(obj.value==""){
alert('请您上传更新文件');
return false;
}
}
var Upload = {
clear: function(id){
var up = (typeof id=="string")?document.getElementById(id):id;
if (typeof up != "object") return null;
var tt = document.createElement("span");
tt.id = "__tt__";
up.parentNode.insertBefore(tt,up);
var tf = document.createElement("form");
tf.appendChild(up);
document.getElementsByTagName("body")[0].appendChild(tf);
tf.reset();
tt.parentNode.insertBefore(up,tt);
tt.parentNode.removeChild(tt);
tt = null;
tf.parentNode.removeChild(tf);
}
}
</script>
<script language="JavaScript" src="js/popcalendar.js" type="text/javascript"></script>
<title>上传ZIP</title>
</head>
<body>
<form name="fileupload" action="dispose.php" method="post" enctype="multipart/form-data" onsubmit="return ts();">
<input type="file" name="path" id="path" onchange="ck(this)"/><input name="submit" type="submit" value="上传" />
</form>
<?php
$ds = date('Y-m-d')." 00:00:00";
$es = date('Y-m-d')." 23:00:00";
echo '<br><table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#c0de98" >';
echo "<tr align='left'>\n";
echo '<td height="18" bgcolor="#FFFFFF" class="STYLE2"><div align="left" class="STYLE2 STYLE1">';
echo "<br>选择要查看的时间";
echo "<br><hr><form name='form1' method='get' action='search_log.php' />\n";
echo " <input type='text' name='DATETIME_s1' value='$ds' size='19' class='butt' readonly=''/> 至 <input type='text' name='DATETIME_e1' size='19' value='$es' class='butt' readonly=''/> <input type='submit' name='Submit' value='Search'/><br>\n";
echo " ";
echo "<input name='按钮' type='button' style='font-size:11px' onClick=\"popUpCalendar(this, form1.DATETIME_s1, 'yyyy-mm-dd',0,' ',1)\" value='选择开始日期'>\n";
echo " ";
echo "<input name='按钮' type='button' style='font-size:11px' onClick=\"popUpCalendar(this, form1.DATETIME_e1, 'yyyy-mm-dd',23,' ',1)\" value='选择截至日期'>\n";
//echo " <input type='submit' value='确定' name='handin'/>";
//----------------------------------------------------------------
echo "</form>\n";
echo "</div></td>";
echo "</tr>\n";
echo "</table>\n";
?>
</body>
</html>
if($filetype=="application/x-zip-compressed"||$filetype=="application/zip"){
if ($_FILES["path"]["error"] > 0)
{
echo "<script>alert('Return Code: " . $_FILES["path"]["error"] .",文件路径错误,请您重新上传')location.href='fileupload.php';</script>";
}
else
{
if (file_exists($filename))
{
echo "<script>alert('exists".$filename.",文件存在,请您重新上传');location.href='fileupload.php';</script>";
}
else
{
if (is_uploaded_file($filetmpname)) {
move_uploaded_file($filetmpname, $filename);
if(! unzip($filename,$uploaddir)){
echo "<script>alert('ErrorUpload,解压ZIP失败,请您重新上传');location.href='fileupload.php';</script>";
exec("rm -f -r ".$uploaddir);
}
unlink($filename);
}
}