📄 savereannounce.php
字号:
<?php
include("pwdsuper.php");
include("connect.inc.php");
include("char.inc.php");
// session_start();
// session_register("master_nickname_session");
$master_nickname_session="集中营论坛";
echo "<html>".chr(13).chr(10);
echo "<head>".chr(13).chr(10);
echo "<meta NAME='GENERATOR' Content='Microsoft FrontPage 3.0'>".chr(13).chr(10);
echo "<meta HTTP-EQUIV='Content-Type' content='text/html; charset=gb_2312-80'>".chr(13).chr(10);
echo "<META HTTP-EQUIV='Expires' CONTENT='0'>".chr(13).chr(10);
echo "<link rel='stylesheet' type='text/css' href='forum.css'>";
echo "<title>发表</title>".chr(13).chr(10);
echo "</head>".chr(13).chr(10);
echo '<body bgcolor="#dcf6ce" text="#666600" link="#009900" alink="#00FF00" vlink="#006600">'.chr(13).chr(10);
$parentid=$followup;
$ip=getenv("REMOTE_ADDR");
$expression=$expression.".gif";
$topic=trim($subject);
$founderror=FALSE;
if (trim($topic)=="")
{
$founderror=TRUE;
if (!isset($errmsg))
{
$errmsg="主题不应为空";
}
else
{
$errmsg=$errmsg+"<Br>"."主题不应为空";
}
}
else
if (strlen(trim($topic))>100)
{
$founderror=TRUE;
if (strlen($errmsg)==0)
{
$errmsg="主题长度不能超过100,超过60个字符后面的字符显示时将被省略,但仍会被完整存储。";
}
else
{
$errmsg=$errmsg+"<Br>"."主题长度不能超过100,超过60个字符后面的字符显示时将被省略,但仍会被完整存储。";
}
}
if (strlen($body)>$ANNOUNCE_MAXBYTE)
{
$errmsg="发言内容不得大于".$ANNOUNCE_MAXBYTE."bytes";
$founderror=TRUE;
}
$regsql="select * from password where NUMBER=".$userid;
$reginfo=@mysql_query($regsql,$conn)or die("reg check error!");
if (mysql_num_rows($reginfo)!=0)
{
$founduser=TRUE;
}
else
{
$errmsg="对不起,你还没有注册,所以您不能留言。请发信给管理员以获得用户名和密码。";
$founderror=TRUE;
}
if ($founderror==TRUE)
{
showAnnounce($errmsg);
}
else
{
//$sql="select * from password where USERID='".$session_no."'";
$visitorsql="select * from zmis41197 where studentnumber=".$userid;
$visitorinfo=@mysql_query($visitorsql,$conn)or die("QUERY ERROR");
if (mysql_num_rows($visitorinfo)!=0)
{
$founduser=TRUE;
$v_info=mysql_fetch_array($visitorinfo);
$v_number=$v_info["studentnumber"];
//$v_name=$v_info["name"];
$v_nickname=$v_info["nickname"];
//$v_icq=$v_info["icq"];
//$v_oicq=$v_info["oicq"];
$v_email=$v_info["email"];
//$v_url=["url"];
}
if ($founderror==TRUE)
{
showAnnounce($errmsg);
}
else
{
$v_article=$v_info["article"]+1;
mysql_query("UPDATE zmis41197 set article=".$v_article." where studentnumber='".$userid."'",$conn);
}
}
//#########################最核心的部分#########################;
if ($founderror==FALSE)
{
$mastersql="select name,nickname,email from zmis41197 where studentnumber=".$userid;
$masterinfo=mysql_query($mastersql,$conn);
$m_info=mysql_fetch_array($masterinfo);
$name=$m_info["name"];
$query2=@mysql_query("select layer,orders from guestbook where id=".$parentid,$conn)or die("query error");
$array2=mysql_fetch_array($query2);
//if (!($rsLayer$eof && $rsLayer$bof))
if(mysql_num_rows($query2)!=0)
{
if (empty($array2["layer"]))
{
$ilayer=0;
}
else
{
$ilayer=$array2["layer"];
}
if (empty($array2["orders"]))
{
$iorders=0;
}
else
{
$iorders=$array2["orders"];
}
}
else
{
$ilayer=0;
$iorders=0;
}
if ($rootid!=0)
{
$ilayer=$ilayer+1;
@mysql_query("update guestbook set orders=orders+1 where rootid=".$rootid." and orders>".$iorders,$conn) or die("Error:order+1");
$iorders=$iorders+1;
}
$datetimestr=strftime('%Y-%m-%d %H:%M:%S %p');
$insertsql='insert into guestbook(mastersn,parentid,child,vnickname,email,topic,body,dateandtime,hits,length,rootid,layer,orders,ip,expression,vnumber)values('.$userid.','.$parentid.',0,"'.$v_nickname.'","'.$v_email.'","'.$topic.'","'.$body.'","'.$datetimestr.'",0,'.strlen($body).','.$rootid.','.$ilayer.','.$iorders.',"'.$ip.'","'.$expression.'","'.$v_number.'")';
@mysql_query($insertsql,$conn) or die("数据库操作失败,请再试#1");
$updatesql="update guestbook set child=child+1 where id=".$parentid;
@mysql_query($updatesql,$conn) or die("数据库操作失败,请再试#2");
//####################在此之上是本论坛的最核心部分###################;
echo "<p align='center'><strong>";
echo htmlspecialchars($topic);
echo "</strong></p> ".chr(13).chr(10);
echo "<hr size='1' color=#00CC00>".chr(13).chr(10);
if (trim($v_email)!="")
{
echo "<p> ";
echo " <a href='mailto:".htmlspecialchars($v_email)."'>";
echo htmlspecialchars($v_nickname);
echo "</a> 于 ".$datetimestr." 加贴在:";
echo "<strong>".$master_nickname_session."</strong>";
echo "</p>".chr(13).chr(10);
}
else
{
echo "<p> ";
echo htmlspecialchars($v_nickname);
echo "</a> 于 ".$datetimestr." 加贴在:";
echo "<strong>".$master_nickname_session."</strong>";
echo "</p>".chr(13).chr(10);
}
echo zlstr($body);
echo "<hr size='1' color=#00CC00>".chr(13).chr(10);
echo "<a href='list.php?userid=".$userid."' target='top'>刷新浏览</a>".chr(13).chr(10);
echo " <a href='announce.php?userid=".$userid."' target='bottom'>继续发贴</a>".chr(13).chr(10);
}
echo "</body>".chr(13).chr(10);
echo "</html>".chr(13).chr(10);
function showAnnounce($errmsg)
{
global $ANNOUNCE_MAXBYTE,$errmsg,$mastersn,$master_nickname_session,$topic,$body,$rootid,$parentid;
echo "<div align='center'><font color='red'><strong>输入错误:</strong></font>".$errmsg."<div><BR>".chr(13).chr(10);
?>
<form action="savereannounce.php?mastersn=<?php echo $mastersn; ?>" method="POST"
name="frmAnnounce">
<input type='hidden' name='rootid' value="<?php echo $rootid; ?>">
<input type='hidden' name='followup' value="<?php echo $parentid; ?>">
<div align="center"><center>
<table border="1" width="530" bordercolorlight="#009900" cellspacing="2" bordercolordark="#009900" height="362">
<tr>
<td width="100%" bgcolor="#83d160" height="17">
<div align="center"><center><p><strong>我
要 发 言</strong></center></div></td>
</tr>
<tr align="center" valign="top">
<td width="100%">
<table border="0" width="100%" cellspacing="1">
<tr>
<td width="15%" align="right">版 面:</td>
<td colspan="2"><strong><?php echo $master_nickname_session; ?></strong> <font color="red"><strong>*</strong></font>为必填项目</td>
</tr>
<tr>
<td width="15%" align="right">主 题:</td>
<td colspan="2">
<input class="smallInput" name="subject" size="65"
maxlength="100" value="<?php echo htmlencode2($topic); ?>">
<font color="red"><strong>*</strong></font> </td>
</tr>
<tr>
<td width="15%" align="right" valign="top"><span class="smallFont">表
情:</span></td>
<td colspan="2">
<input type="radio" value="smiley" name="expression" checked>
<img
src="images/smiley.gif" width="15" height="15">
<input type="radio" name="expression"
value="sad">
<img src="images/sad.gif" width="16" height="16">
<input type="radio"
name="expression" value="angry">
<img src="images/angry.gif" width="15" height="15">
<input
type="radio" name="expression" value="13">
<img src="images/13.gif" width="15" height="15">
<input
type="radio" name="expression" value="14">
<img src="images/14.gif" width="15" height="15">
<input type="radio" name="expression" value="15">
<img src="images/15.gif" width="15"
height="15">
<input type="radio" name="expression" value="16">
<img src="images/16.gif"
width="15" height="15"> <br>
<input type="radio" value="18" name="expression">
<img src="images/18.gif" width="15"
height="15">
<input type="radio" name="expression" value="17">
<img src="images/17.gif"
width="15" height="15">
<input type="radio" name="expression" value="19">
<img
src="images/19.gif" width="15" height="15">
<input type="radio" name="expression"
value="20">
<img src="images/20.gif" width="15" height="15">
<input type="radio"
name="expression" value="21">
<img src="images/21.gif" width="15" height="15">
<input
type="radio" name="expression" value="22">
<img src="images/22.gif" width="15" height="15">
<input type="radio" name="expression" value="23">
<img src="images/23.gif" width="15"
height="15"> </td>
</tr>
<tr>
<td width="15%" align="right"><span class="smallFont">内 容:</span></td>
<td width="64%"><span class="smallFont">(最多<?php echo $ANNOUNCE_MAXBYTE/1024; ?>KB)</span></td>
<td width="21%">
<div align="center">
<center>
<p>
</center>
</div>
</td>
</tr>
<tr align="center">
<td width="15%"><span class="smallFont"></span></td>
<td colspan="2">
<div align="left">
<p>
<textarea class="smallarea" cols="65"
name="body" rows="10"><?php echo htmlencode2($body); ?></textarea>
</div>
</td>
</tr>
<tr align="center">
<td colspan="3"><span class="smallFont">
<input class="buttonface" type="submit"
value=" 发 送 " name="submit">
<input class="buttonface" type="reset" value=" 重 填 " name="reset">
</span></td>
</tr>
</table>
</td>
</tr>
</table>
</center></div>
</form>
<?php
}
?></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -