📄 inbox.php
字号:
<?php
session_start();
if (!empty($downfile)) {
if (!@file_exists($downfile)) {
echo "<script>alert('你要下的文件不存在!')</script>";
//echo "下载出错";
} else {
$filename = basename($downfile);
$filename_info = explode('.', $filename);
$fileext = $filename_info[count($filename_info)-1];
header('Content-type: application/x-'.$fileext);
header('Content-Disposition: attachment; filename='.$filename);
header('Content-Description: PHP Generated Data');
header('Content-Length: '.filesize($downfile));
@readfile($downfile);
exit;
}
}
include "middle.php";
require_once "../MessageBox.php";
$Message = new MessageBox;
?>
<link href="../css/a1.css" rel="stylesheet" type="text/css">
<body leftmargin="0" topmargin="0">
<table width="789" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"><img src="../images/home_12.jpg" width="789" height="12"></td>
</tr>
<tr>
<td width="776" valign="top">
<?php
if ( !empty($_SESSION["userid"]) ) {
include "../datasource.inc.php";
$page = $_REQUEST['page'];
$id = $_REQUEST['id'];
$action = $_REQUEST['action'];
$date = date("Y-m-d");
/* if (! ($_SESSION['userid'] == "0") ) {
$sql = "select * from inbox where addressee='$_SESSION[userid]' order by id desc;";
$result = mysql_query($sql);
for ( $i=0;$i<2;$i++ ) {
$row = mysql_fetch_array($result);
if ($_SESSION['read'] == "1" ) {
break;
} else {
if ( $row['read']=="0" ) {
echo "
<script language=javascript1.2>
window.open(\"../news1.html\",'_blank','top=3,right=60,height=120,width=140,toolbar=0,menubar=0,scrollbars=0,resizable=0,status=0');
</script>";
$sql1 = "update inbox set read='1' where id='$row[id]';";
$result1 = mysql_query($sql1);
$_SESSION['read'] = "1";
}
}
}
}
*/
if ($action=='return') {
$addressee = $_REQUEST['addressee2'];
$content = $_REQUEST['content'];
$addresser = $_SESSION['realname'];
$department = $_SESSION['department'];
$title = $_REQUEST['title'];
/* $file_name01 = $_FILES['job_path']['name'];
mt_srand((double)microtime()*1000000);
$shpid = uniqid(mt_rand());
$shpid = substr($shpid,0,8);
$file_name1 = $shpid.$file_name01;
$picpath1 = $path.$file_name1;
copy($HTTP_POST_FILES['job_path']['tmp_name'],$picpath1);
$shpidfilename = $shpid.".".substr($file_name01,-3);
@rename("$path/$file_name1","$path/$shpidfilename");
*/
$sql = "insert into outbox (id,addressee,content,addresser,time,department,job_path,title) values ('','$addressee','$content','$addresser','$date','$department','0','$title');";
$result = mysql_query($sql);
$sql1 = "insert into inbox values ('','$addresser','$content','$addressee','0','$date','0','$title');";
$result1 = mysql_query($sql1);
$Message->setMessage("回复成功!","inbox.php");
$Message->showMessage();
}
if ($action=='forward') {
$addressee = $_REQUEST['addressee'];
$content = $_REQUEST['content'];
$addresser = $_SESSION['realname'];
$department = $_SESSION['department'];
$title = $_REQUEST['title'];
$job_path = $_REQUEST['job_path'];
/* $file_name01 = $_FILES['job_path']['name'];
mt_srand((double)microtime()*1000000);
$shpid = uniqid(mt_rand());
$shpid = substr($shpid,0,8);
$file_name1 = $shpid.$file_name01;
$picpath1 = $path.$file_name1;
copy($HTTP_POST_FILES['job_path']['tmp_name'],$picpath1);
$shpidfilename = $shpid.".".substr($file_name01,-3);
@rename("$path/$file_name1","$path/$shpidfilename");
*/
$sql = "insert into outbox (id,addressee,content,addresser,time,department,job_path,title) values ('','$addressee','$content','$addresser','$date','$department','$job_path','$title');";
$result = mysql_query($sql);
$sql1 = "insert into inbox values ('','$addresser','$content','$addressee','0','$date','$job_path','$title');";
$result1 = mysql_query($sql1);
$Message->setMessage("转发成功!","inbox.php");
$Message->showMessage();
}
?>
<script language=javascript>
function check_input()
{
if (document.form.title.value=='') {
alert ("请输入主旨!");
return false;
}
if (document.form.addressee.value=='') {
alert("请输入收件人名称!");
return false;
}
if (document.form.content.value=='') {
alert("请输入内容!");
return false;
}
}
function OpenWin(URL){
newwindow=window.open(URL ,'日期选择','width=200,height=230,scrollbars=1,resizable=1');
newwindow.focus();
}
</script>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<TD vAlign=top><FONT color=#565656> <IMG height=14
src="../images/closedfold.gif" width=14> 您当前的位置<BR> <IMG
height=15 src="../images/bar.gif" width=15> <IMG height=14
src="../images/openfold.gif" width=14> 我的收件箱</FONT></TD>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width=766 align="right">
<tr><td width=766 height=1 bgcolor=#3494d4></td>
</tr>
</table><br>
<?
switch ($page){
case "return":
$sql = "select * from inbox where id='$id'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
?>
<center>
<form name=form action="inbox.php" method="post" onsubmit="return check_input()">
<table width=776 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=10 bgcolor=#ffffff> </td>
<td><table border=0 cellpadding=0 cellspacing=1 bgcolor=#3494d4 width=766>
<tr>
<td width="15%" align="center" bgcolor=#ffffff>主 旨</td>
<td width="85%" bgcolor=#ffffff> <input type="text" size="30" name="title" maxlength="20" height=24></td>
</tr>
<tr>
<td width="15%" align=center bgColor=#ffffff>收件人</td>
<td width="85%" bgcolor=ffffff> <input type="text" size="30" name="addressee2" maxlength="20" height=24 value=<? echo $row['addresser'];?>>
</td>
</tr>
<tr>
<td width="15%" align=center bgColor=#ffffff>内 容</td>
<td width="85%" bgColor=#ffffff> <textarea name="content" cols="65" rows="10"></textarea> <font color=red>*</font></td>
</tr>
</table>
</td>
</tr>
</table><br>
<input type="hidden" value="return" name="action">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="hidden" name="addresser" value="<? $_SESSION["realname"] ?>">
<input type="hidden" name="department" value="<? $_SESSION["department"] ?>">
<input type="submit" name="submit" value=" 确 定 "> <input type="reset" name="submit1" value=" 重 置 ">
</form>
</center>
<?
break;
case "forward":
$sql = "select * from inbox where id='$id'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
?>
<center>
<form name=form action="inbox.php" method="post" onsubmit="return check_input()">
<table width=776 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=10 bgcolor=#ffffff> </td>
<td><table border=0 cellpadding=0 cellspacing=1 bgcolor=#3494d4 width=766>
<tr>
<td width="15%" align="center" bgcolor=#ffffff>主 旨</td>
<td width="85%" bgcolor=#ffffff> <input type="text" size="30" name="title" maxlength="20" height=24 value=<? echo $row['title'];?>></td>
</tr>
<tr>
<td width="15%" align=center bgColor=#ffffff>收件人</td>
<td width="85%" bgcolor=ffffff> <input type="text" size="30" class="for02" name="addressee" maxlength="20" height=24>
<a href="JavaScript:OpenWin('PickUser.php?chanField=form.addressee');">选择收件人</a>
<font color=red>*</font>
</td>
</tr>
<?
if ( strlen($row["job_path"]) > 9 ) {
?>
<tr>
<td width="15%" bgColor=#ffffff align=center>发送文件</td>
<td width="85%" bgcolor=ffffff> <input type="text" size="20" name="job_path" value="<? echo $row["job_path"];?>"></td>
</tr>
<?
}
?>
<tr>
<td width="15%" align=center bgColor=#ffffff>内 容</td>
<td width="85%" bgColor=#ffffff> <textarea name="content" cols="65" rows="10"><? echo $row['content'];?></textarea><font color=red>*</font></td>
</tr>
</table>
</td>
</tr>
</table><br>
<input type="hidden" value="forward" name="action">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="hidden" name="addresser" value="<? $_SESSION["realname"] ?>">
<input type="hidden" name="department" value="<? $_SESSION["department"] ?>">
<input type="submit" name="submit" value=" 确 定 "> <a href="inbox.php?page=return"><input type="reset" name="submit1" value=" 重 置 "></a>
</form>
</center>
<?
break;
case "delete":
$query = "delete from inbox where id='$id';";
mysql_query($query);
$Message->setMessage("删除成功!","inbox.php");
$Message->showMessage();
break;
default :
$sql = "select * from inbox where addressee='$_SESSION[realname]' order by id desc";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if ( $num>0 ){
$last = intval(($num-1)/40)+1;
if ( $page < 1 ) $page=1;
if ( $page > $last ) $page=$last;
mysql_data_seek($result,($page-1)*40);
echo "<table border=0 cellpadding=0 cellspacing=0 width=776>";
echo "<tr><td width=10 bgcolor=#ffffff> </td>";
echo "<td><table border=0 cellpadding=0 cellspacing=1 bgcolor=#3494d4 width=766>";
echo "<tr height=24>";
echo "<td width=175 bgColor=#3494d4><div align=center><font color=#ffffff><b>发件时间</b></font></div></td>";
echo "<td width=75 bgColor=#3494d4><div align=center><font color=#ffffff><b>发件人</b></font></div></td>";
echo "<td width=300 bgColor=#3494d4><div align=center><font color=#ffffff><b>主旨</b></font></div></td>";
echo "<td width=58 bgColor=#3494d4><div align=center><font color=#ffffff><b>查看</b></font></div></td>";
echo "<td width=50 bgColor=#3494d4><div align=center><font color=#ffffff><b>回复</b></font></div></td>";
echo "<td width=50 bgColor=#3494d4><div align=center><font color=#ffffff><b>转发</b></font></div></td>";
echo "<td width=58 bgColor=#3494d4><div align=center><font color=#ffffff><b>删除</b></font></div></td>";
echo "</tr>";
for ( $i=0;$i<40;$i++ ) {
$row = mysql_fetch_array($result);
$id = $row['id'];
$job_body = substr($row['job_body'],0,30);
if ( $id ) {
echo "<tr bgColor=#ffffff height=22>";
echo "<td width=175 bgColor=#ffffff align=center>$row[time]</td>";
echo "<td width=75 bgColor=#ffffff align=center>$row[addresser]</td>";
echo "<td width=300 bgColor=#ffffff align=center>$row[title]</td>";
echo "<td width=58 bgColor=#ffffff align=center><a href=# onClick=\"window.open('inbox_show.php?id=$row[id]',1,'top=50,left=50,height=450,width=450,scrollbars=yes')\">查看</a></td>";
echo "<td width=50 bgColor=#ffffff><div align=center><font color=#3494d4><a href=inbox.php?page=return&id=$row[id]>回复</a></font></div></td>";
echo "<td width=50 bgColor=#ffffff><div align=center><font color=#3494d4><a href=inbox.php?page=forward&id=$row[id]>转发</a></font></div></td>";
echo "<td width=58 bgColor=#ffffff align=center><a title=点击删除本条记录 href=inbox.php?page=delete&id=$row[id] onclick=\"return confirm('确定要删除吗?')\"><img src=../images/clearicon.gif border=0></a></td>";
echo "</tr>";
}
}
echo "</table></td></table><br>";
echo "<table width=500 border=0 cellspacing=0 cellpadding=0 height=24 align=center>";
echo "<tbody>";
echo "<tr><td><center>";
echo "总共找到<font color=red>$num</font>条记录,第<font color=red>$page</font>页,共<font color=red>$last</font>页。";
echo "</center></td></tr><tr>";
if ( $page <> 1 ) {
echo "<td align=center> <a href=inbox.php?page=1>第一页</a></td>";
echo "<td align=center><a href=inbox.php?page=".($page-1).">上一页</a></td>";
}
if ( $page <> $last ) {
echo "<td align=center><a href=inbox.php?page=".($page+1).">下一页</a></td>";
echo "<td align=center><a href=inbox.php?page=$last>最后一页</a></td>";
}
echo "</tbody>";
echo "</tr>";
echo "</table><br>";
echo "</center>";
} else {
echo "<center>对不起,找不到符合条件的记录!</center>";
}
break;
}
} else {
$Message->setMessage("对不起,您没有权限进入后台管理!","index.php");
$Message->showMessage();
}
?>
</td>
<td width="13" align="right" background="../images/home_16.jpg" height=457> </td>
</tr>
<tr>
<td height="8" colspan="2" valign="top"><img src="../images/home_24.jpg" width="789" height="8"></td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -