📄 messanger.php
字号:
<?
require("global.php");
require("userdata/style.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
p,td,input,select{ font-size: 9pt; color:#333333;}
a {color:#333333;font-size: 9pt;text-decoration:none; }
a:hover {color:#000000;text-decoration:underline overline;}
a:active {color:#FF6699;}
-->
</style>
</head>
<body bgcolor=<?=$backgroundcolor?> leftmargin=0 topmargin=0 marginwidth=0>
<script>
function popwin2(id,path)
{ window.open("songs.php?action=song_st&dgno="+id,"","height=470,width=395,resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no");
}</script>
<p>
<?
if (!$login_status) {echo "对不起,您还未登录"; exit;}
$user=$username;
if ($job=="read") {
if (file_exists("userdata/$msgpath/{$user}1.php")) {
$receivelist=file("userdata/$msgpath/{$user}1.php");
list($fb,$author,$title,$time,$content,$isread)=explode("|",$receivelist[$msg]);
$ctime=getfulldate($time);
echo "<br><font color=5A6633>作者:</font>$author<br><font color=5A6633>题目:</font>$title<br>$ctime<br>$content";
echo "<br><br><font color=5A6633>选项: [<a href='messanger.php?job=write&target=$author'>回复</a>] [<a href='messanger.php?job=delone&msg=$msg'>删除</a>] [<a href='messanger.php?job=receivebox'>返回</a>]</font>";
$count=count($receivelist);
$fp=fopen("userdata/$msgpath/{$user}1.php","w");
for ($i=0; $i<$count; $i++) {
if ($i!=$msg) fputs($fp,$receivelist[$i]);
else fputs($fp,"$fb|$author|$title|$time|$content|1|\n");
}
fclose($fp);
}
}
if ($job=="readsnd") {
if (file_exists("userdata/$msgpath/{$user}2.php")) {
$sendlist=file("userdata/$msgpath/{$user}2.php");
list($fb,$ruser,$title,$time,$content)=explode("|",$sendlist[$msg]);
$ctime=getfulldate($time);
echo "<br><font color=5A6633>接收用户:</font>$ruser<br><font color=5A6633>题目:</font>$title<br>$ctime<br>$content";
echo "<br><br><font color=5A6633>选项: [<a href='messanger.php?job=write&target=$ruser'>另发信息</a>] [<a href='messanger.php?job=delsnd&msg=$msg'>删除</a>] [<a href='messanger.php?job=sendbox'>返回</a>]</font>";
$count=count($sendlist);
}
}
if ($job=="receivebox") {
if (file_exists("userdata/$msgpath/{$user}1.php")) {
$receivelist=file("userdata/$msgpath/{$user}1.php");
$count=count($receivelist);
if ($count<=1 && empty($receivelist[0])) {echo"<br>空的收件箱,您没有任何短消息";exit;}
if($count>=$short_msg_max) echo "你的短消息已存满,<a href='dumpmsg.php'>请注意备份</a>";
echo "<table bgcolor=$forumcolortwo width=205 border=0 cellspacing=0 cellpadding=2 align=center><tr align=center><td width=67><b><font color=444444>作者</font></b></td><td width=110><b><font color=444444>题目</font></b></td><td width=26><font color=5A6633>已读</font></td></tr></table>";
sline_msg();
for ($i=0; $i<$count; $i++) {
list($fb,$author,$title,$time,$content,$isread)=explode("|",$receivelist[$i]);
if ($isread) $isread="是"; else $isread="否";
echo "<table width=205 border=0 cellspacing=0 cellpadding=2 align=center><tr align=center><td width=67><acronym title='给用户发一个短信息'><a href='messanger.php?job=write&target=$author'>$author</a></acronym></td><td width=110><a href='messanger.php?job=read&msg=$i'>$title</a></td><td width=26>$isread</td></tr></table>";
sline_msg();
}
}
else {echo "<br>空的收件箱,您没有任何短消息"; exit; }
}
if ($job=="write") {
if (empty($step)) print_form();
elseif($step==2) {
if (empty($content) || empty($ruser) || !file_exists("$userpath/$ruser.php")) {
echo "对不起,发生资料错误,请 <a href='javascript:history.back(1);'>返回检查</a>";
exit;
}
if (file_exists("userdata/$msgpath/{$ruser}1.php")) $msg=file("userdata/$msgpath/{$ruser}1.php");
else $msg[0]="";
$content=stripslashes(safe_convert($content));
$title=stripslashes(safe_convert($title));
$title="信息:".$title;
$new="<?die;?>|$user|$title|$timestamp|$content|0|\n";
$oldcount=count($msg);
if ($oldcount>$short_msg_max) {
for ($i=$short_msg_max; $i<$oldcount; $i++) unset($msg);
}
$old=implode("",$msg);
writetofile("userdata/$msgpath/{$ruser}1.php",$new.$old);
if (file_exists("userdata/$msgpath/{$user}2.php")) $old=readfromfile("userdata/$msgpath/{$user}2.php");
else $old="";
$oldcount=count($old);
if ($oldcount>$short_msg_max) {
for ($i=$short_msg_max; $i<$oldcount; $i++) unset($old);
}
$new="<?die;?>|$ruser|$title|$timestamp|$content|\n";
writetofile("userdata/$msgpath/{$user}2.php",$new.$old);
echo "<br>已经完成,<a href='messanger.php?job=receivebox'>点这里返回收件箱</a>";
exit;
}
}
if ($job=="clear") {
if (file_exists("userdata/$msgpath/{$user}1.php")) unlink("userdata/$msgpath/{$user}1.php");
if (file_exists("userdata/$msgpath/{$user}2.php")) unlink("userdata/$msgpath/{$user}2.php");
echo "<br>您的所有短信息已被成功清空";
exit;
}
if ($job=="sendbox") {
if (file_exists("userdata/$msgpath/{$user}2.php")) {
$receivelist=file("userdata/$msgpath/{$user}2.php");
$count=count($receivelist);
if ($count<=1 && empty($receivelist[0])) {echo"<br>空的收件箱,您没有任何短消息";exit;}
echo "<table bgcolor=$forumcolortwo width=205 border=0 cellspacing=0 cellpadding=2 align=center><tr align=center><td width=60><b>接收用户</b></td><td width=145><b>题目</b></td></tr></table>";
sline_msg();
for ($i=0; $i<$count; $i++) {
list($fb,$ruser,$title,$time,$content)=explode("|",$receivelist[$i]);
echo "<table width=205 border=0 cellspacing=0 cellpadding=2 align=center><tr align=center><td width=60><acronym title='给用户发一个短信息'><a href='messanger.php?job=write&target=$ruser'>$ruser</a></acronym></td><td width=145><a href='messanger.php?job=readsnd&msg=$i'>$title</a></td></tr></table>";
sline_msg();
}
}
else {echo "<br>空的发件箱,您没有任何短消息"; exit; }
}
if ($job=="delone") {
if (file_exists("userdata/$msgpath/{$user}1.php")) {
$receivelist=file("userdata/$msgpath/{$user}1.php");
$count=count($receivelist);
$fp=fopen("userdata/$msgpath/{$user}1.php","w");
for ($i=0; $i<$count; $i++) {
if ($i!=$msg) fputs($fp,$receivelist[$i]);
}
fclose($fp);
echo "<br>成功删除一条信息,<a href='messanger.php?job=receivebox'>点这里返回收件箱</a>";
exit;
}
}
if ($job=="delsnd") {
if (file_exists("userdata/$msgpath/{$user}2.php")) {
$receivelist=file("userdata/$msgpath/{$user}2.php");
$count=count($receivelist);
$fp=fopen("userdata/$msgpath/{$user}2.php","w");
for ($i=0; $i<$count; $i++) {
if ($i!=$msg) fputs($fp,$receivelist[$i]);
}
fclose($fp);
echo "<br>成功删除一条信息,<a href='messanger.php?job=sendbox'>点这里返回发件箱</a>";
exit;
}
}
if ($job=="showzt") {
if (file_exists("userdata/$msgpath/{$user}1.php")) {
$receivelist=file("userdata/$msgpath/{$user}1.php");
$count=count($receivelist);
$contl=($count/$short_msg_max)*100;
echo"目前有短消息<font color=red>".$count."</font>条<br>";
echo"最多可存消息<font color=red>".$short_msg_max."</font>条<br>";
echo"使用率<font color=red>".$contl."%</font><br><a href='dumpmsg.php'>请及时备份你的消息</a>,超过最大数,系统会自动删除";
echo "<br><br><a href='messanger.php?job=receivebox'>点这里返回收件箱</a>";
exit;
}
}
function sline_msg() {
print ("<table cellspacing=0 cellpadding=0 width=205 align=center bgcolor=#777777 border=0><tr><td height=1></td></tr></table>");
}
function print_form() {
global $target;
?>
<table width=205 border=0 cellspacing=0 cellpadding=0>
<tr bgcolor=<?=$forumcolortwo?>>
<td>请填写信息</td>
</tr><form action=messanger.php method=POST>
<tr bgcolor=<?=$backgroundcolor?>>
<td>
接收用户:
<input <? if (isset($target)) echo "value='$target'"; ?> style="background-color:#FEFEFF; color:#9999FF; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut ="this.style.backgroundColor =''" type=text size=10 name="ruser"><br>
题 目:
<input style="background-color:#FEFEFF; color:#9999FF; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut ="this.style.backgroundColor =''" type=text size=10 name="title">
<br>
信息内容:<br>
<textarea style="background-color:#FEFEFF; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#f3f3f3'" onMouseOut = "this.style.backgroundColor = ''" name="content" cols=25 rows=3></textarea>
<br>
</td>
</tr>
<tr bgcolor=<?=$backgroundcolor?>>
<td><input style="color: #000000; background-color: #f3f3f3; border-style: solid; border-width: 1" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'" type=submit value="提 交">
<input type=hidden name=job value=write>
<input type=hidden name=step value=2>
</td>
</tr></form>
</table>
<?}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -