📄 file.php
字号:
<?
require("../../class/connect.php");
include("../../class/db_sql.php");
include("../../class/functions.php");
include("../../class/config.php");
include("../../class/class.php");
include("../../data/language/fun.php");
include("../../data/language/message.php");
$link=db_connect();
$empire=new mysqlquery();
$logininid=$_GET['userid'];
$loginin=$_GET['username'];
$loginrnd=$_GET['rnd'];
$classid=$_GET['classid'];
$type=$_GET['type'];
$doing=$_GET['doing'];
$field=$_GET['field'];
if(empty($field))
{$field="ecms";}
$editor=1;
is_login($logininid,$loginin,$loginrnd);
$search="&userid=$logininid&username=$loginin&rnd=$loginrnd&classid=$classid&type=$type&doing=$doing&field=$field";
//-------------分页
$page=$_GET['page'];
$start=$_GET['start'];
$line=16;//每页显示条数
$page_line=12;//每页显示链接数
if(empty($page))
{$page=0;}
if(empty($start))
{$start=0;}
$offset=$start+$page*$line;//总偏移量
$query="select * from phome_enewsfile where type='$type'";
$num=$empire->num($query);//取得总条数
$query=$query." order by fileid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>插入文件</title>
<link href="edit.css" rel="stylesheet" type="text/css">
<link href="../../data/images/css.css" rel="stylesheet" type="text/css">
<script>
function InsertFile(str)
{
opener.DoFile(str);
}
function ChangeFile1(obj,str)
{
if(obj==1)
{opener.document.add.<?=$field?>.value=str;}
else
{opener.document.form1.<?=$field?>.value=str;}
}
</script>
<script src=ebb.js></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td height="230" colspan="3"> <IFRAME frameBorder=0 id=tran name=tran scrolling=auto src=tran.php<? echo"?userid=$logininid&username=$loginin&rnd=$loginrnd&type=$type&classid=$classid";?> style=HEIGHT:100%;VISIBILITY:inherit;WIDTH:100%;Z-INDEX:1></IFRAME>
</td>
</tr>
<tr>
<td width="41%"> </td>
<td width="21%"><div align="center"> </div></td>
<td width="38%"> </td>
</tr>
</table>
<?
//图片
if($type==1)
{
$i=0;
$line=3;//每行显示图片数
$width=100;
$height=80;
//编号截取数
$sub=23;
while($r=$empire->fetch($sql))
{
$ono=$r[no];
$r[no]=sub($r[no],0,$sub,false);
//MB
if($r[filesize]>=1024*1024)
{
$filesize=number_format($r[filesize]/(1024*1024),2,'.','')." MB";
}
//KB
elseif($r[filesize]>=1024)
{
$filesize=number_format($r[filesize]/1024,2,'.','')." KB";
}
else
{
$filesize=$r[filesize]." Bytes";
}
$i++;
if(($i-1)%$line==0||$i==1)
{$class_text.="<tr bgcolor=#DBEAF5>";}
//是否按类别分
if($r[classid])
{
$file=$public_r[fileurl].$class_r[$r[classid]][classpath]."/".$r[path]."/".$r[filename];
}
else
{
$file=$public_r[fileurl]."p/".$r[path]."/".$r[filename];
}
$pic=$file;
//返回地址
if($doing==1)
{
$returnstr=$pic;
$button="<input type=button name=button value='选择' onclick=\"javascript:ChangeFile1(1,'".$pic."');\">";
}
elseif($doing==2)
{
$returnstr=$pic;
$button="<input type=button name=button value='选择' onclick=\"javascript:ChangeFile1(2,'".$pic."');\">";
}
else
{
$returnstr="<a href=\'".$public_r[newsurl]."e/ViewImg/index.html?url=".$pic."\' title=\'点击放大\' target=_blank><img src=".$pic." border=0></a>";
$button="<input type=button name=button value='插入' onclick=\"javascript:InsertFile('".$returnstr."');\">";
}
$viewstr="预览";
$class_text.="<td><table width=100% border=0 cellspacing=1 cellpadding=2>
<tr>
<td width=28% valign=top>图片:</td>
<td width=72%><a href='../../ViewImg/index.html?url=".$file."' target='_blank' title='预览:".$r[filename]."'><img src='".$pic."' width='".$width."' height='".$height."' border=0></a></td>
</tr>
<tr>
<td>编号:</td>
<td><a title='".$ono."'>".$r[no]."</a></td>
</tr>
<tr>
<td>文件大小:</td>
<td>".$filesize."</td>
</tr>
<tr>
<td>所属类别:</td>
<td>".$class_r[$r[classid]][classname]."</td>
</tr>
<tr>
<td colspan=2><div align=center>".$button."</div></td>
</tr>
</table></td>";
//分割
if($i%$line==0&&$i<>1)
{$class_text.="</tr>";}
}
if($i<>0)
{$table="<table width=100% border=0 cellpadding=3 cellspacing=1 bgcolor=#698CC3>
<tr>
<td><strong><font color=#FFFFFF>插入/选择图片</font></strong></td>
</tr>
<tr>
<td bgcolor=#FFFFFF><table width=100% border=1 align=center cellpadding=2 cellspacing=1 bordercolor=#FFFFFF bgcolor=#FFFFFF>";
$table1="</table></td>
</tr>
<tr>
<td bgcolor=#FFFFFF>
".$returnpage."
</td>
</tr>
</table>";
$ys=$line-$i%$line;
for($j=0;$j<$ys;$j++)
{
$class_text.="<td> </td>";
if($ys==($j-1))
{$class_text.="<tr>";}
}
}
$text=$table.$class_text.$table1;
echo"$text";
}
//flash
elseif($type==2)
{
?>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td height="25">插入FLASH:</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#698CC3">
<tr>
<td width="7%"><div align="center"><font color="#FFFFFF">ID</font></div></td>
<td width="43%"><div align="center"><font color="#FFFFFF">文件名</font></div></td>
<td width="18%"><div align="center"><font color="#FFFFFF">大小</font></div></td>
<td width="22%"><div align="center"><font color="#FFFFFF">上传时间</font></div></td>
<td width="10%"><div align="center"><font color="#FFFFFF">选择</font></div></td>
</tr>
<?
while($r=$empire->fetch($sql))
{
//MB
if($r[filesize]>=1024*1024)
{
$filesize=number_format($r[filesize]/(1024*1024),2,'.','')." MB";
}
//KB
elseif($r[filesize]>=1024)
{
$filesize=number_format($r[filesize]/1024,2,'.','')." KB";
}
else
{
$filesize=$r[filesize]." Bytes";
}
//按类别分
if($r[classid])
{
$file=$public_r[fileurl].$class_r[$r[classid]][classpath]."/".$r[path]."/".$r[filename];
}
else
{
$file=$public_r[fileurl]."p/".$r[path]."/".$r[filename];
}
//取得文件类型
$filetype=substr(GetFiletype($r[filename]),1);
$returnstr="<object classid=\\\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\\\" codebase=\\\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\\\" name=\\\"movie\\\" width=\\\"400\\\" height=\\\"350\\\" id=\\\"movie\\\"><param name=\\\"movie\\\" value=\\\"".$file."\\\"><param name=\\\"quality\\\" value=\\\"high\\\"><param name=\\\"menu\\\" value=\\\"false\\\"><embed src=\\\"".$file."\\\" width=\\\"400\\\" height=\\\"350\\\" quality=\\\"high\\\" pluginspage=\\\"http://www.macromedia.com/go/getflashplayer\\\" type=\\\"application/x-shockwave-flash\\\" id=\\\"movie\\\" name=\\\"movie\\\" menu=\\\"false\\\"></embed></object>";
$returnstr=htmlspecialchars($returnstr);
//---------返回地址
$pic=$file;
if($doing==1)
{
$returnstr=$pic;
$button="<input type=button name=button value='选择' onclick=\"javascript:ChangeFile1(1,'".$pic."');\">";
}
elseif($doing==2)
{
$returnstr=$pic;
$button="<input type=button name=button value='选择' onclick=\"javascript:ChangeFile1(2,'".$pic."');\">";
}
else
{
$button="<input type=button name=button value='插入' onclick=\"javascript:InsertFile('".$returnstr."');\">";
}
?>
<tr>
<td bgcolor="#FFFFFF"> <div align="center">
<?=$r[fileid]?>
</div></td>
<td bgcolor="#FFFFFF"> <div align="center">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="20%">编号:</td>
<td width="80%">
<?=$r[no]?>
</td>
</tr>
<tr>
<td>文件名:</td>
<td>
<a href='<?=$pic?>' target=_blank><?=$r[filename]?></a>
</td>
</tr>
</table>
</div></td>
<td bgcolor="#FFFFFF"> <div align="center">
<?=$filesize?>
</div></td>
<td bgcolor="#FFFFFF"> <div align="center">
<?=$r[filetime]?>
</div></td>
<td bgcolor="#FFFFFF"> <div align="center">
<?=$button?>
</div></td>
</tr>
<?
}
?>
<tr>
<td colspan="5" bgcolor="#FFFFFF"> <?=$returnpage?></td>
</tr>
</table>
<?
}
//附件
else
{
?>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td height="25">插入附件:</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#698CC3">
<tr>
<td width="7%"><div align="center"><font color="#FFFFFF">ID</font></div></td>
<td width="43%"><div align="center"><font color="#FFFFFF">文件名</font></div></td>
<td width="18%"><div align="center"><font color="#FFFFFF">大小</font></div></td>
<td width="22%"><div align="center"><font color="#FFFFFF">上传时间</font></div></td>
<td width="10%"><div align="center"><font color="#FFFFFF">选择</font></div></td>
</tr>
<?
while($r=$empire->fetch($sql))
{
//MB
if($r[filesize]>=1024*1024)
{
$filesize=number_format($r[filesize]/(1024*1024),2,'.','')." MB";
}
//KB
elseif($r[filesize]>=1024)
{
$filesize=number_format($r[filesize]/1024,2,'.','')." KB";
}
else
{
$filesize=$r[filesize]." Bytes";
}
//按类别分
if($r[classid])
{
$path1=$public_r[fileurl].$class_r[$r[classid]][classpath]."/".$r[path]."/".$r[filename];
}
else
{
$path1=$public_r[fileurl]."p/".$r[path]."/".$r[filename];
}
//取得文件类型
$filetype=substr(GetFiletype($r[filename]),1);
$returnstr="<div style=\'padding:6px\'><fieldset><legend>上传的附件</legend><table cellpadding=0 cellspacing=3 border=0><tr><td><img src=\'".$public_r[newsurl]."e/data/type/trantype/".$filetype.".gif\' alt=\'文件类型: ".$filetype."\' border=0 style=\'vertical-align:baseline\'></td><td><a href=\'".$public_r[newsurl]."e/public/DownFile?fileid=".$r[fileid]."\' title=\'".$r[no]."\' target=\'_blank\'>".$r[filename]."</a> (".$filesize.")</td></tr></table></fieldset></div>";
//---------返回地址
$pic=$path1;
if($doing==1)
{
$returnstr=$pic;
$button="<input type=button name=button value='选择' onclick=\"javascript:ChangeFile1(1,'".$pic."');\">";
}
elseif($doing==2)
{
$returnstr=$pic;
$button="<input type=button name=button value='选择' onclick=\"javascript:ChangeFile1(2,'".$pic."');\">";
}
else
{
$button="<input type=button name=button value='插入' onclick=\"javascript:InsertFile('".$returnstr."');\">";
}
?>
<tr>
<td bgcolor="#FFFFFF"> <div align="center">
<?=$r[fileid]?>
</div></td>
<td bgcolor="#FFFFFF"> <div align="center">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="20%">编号:</td>
<td width="80%">
<?=$r[no]?>
</td>
</tr>
<tr>
<td>文件名:</td>
<td>
<a href='<?=$path1?>' target=_blank><?=$r[filename]?></a>
</td>
</tr>
</table>
</div></td>
<td bgcolor="#FFFFFF"> <div align="center">
<?=$filesize?>
</div></td>
<td bgcolor="#FFFFFF"> <div align="center">
<?=$r[filetime]?>
</div></td>
<td bgcolor="#FFFFFF"> <div align="center">
<?=$button?>
</div></td>
</tr>
<?
}
?>
<tr>
<td colspan="5" bgcolor="#FFFFFF"> <?=$returnpage?></td>
</tr>
</table>
<?
}
?>
<br>
<input type="submit" name="Submit" value="关闭" onclick="window.close();">
</body>
</html>
<?
db_close();
$empire=null;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -