⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 saveannounce.php

📁 php做的一个同学录网站,功能齐全. 后台管理非常方便,有需要的同学可以下载测试.
💻 PHP
字号:
<?php
//  session_start();
include("pwdsuper.php");
include("connect.inc.php");
include("char.inc.php");
$master_nickname_session="集中营论坛";
?>
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 3.0">
<meta HTTP-EQUIV="Expires" CONTENT="0">
<link rel="stylesheet" type="text/css" href="forum.css">
<title>我要发言</title>
</head>
<body bgcolor="#dcf6ce" text="#666600" link="#009900" alink="#00FF00" vlink="#006600">
<?php
$ip=getenv("REMOTE_ADDR");
$expression=$expression.".gif";
$topic=trim($subject);
$founderror=FALSE;
if (empty($topic))
{
  $founderror=TRUE;
  if (!isset($errmsg))
  { //$topic="";
    $errmsg="主题不应为空";
  }
    else
  { //$topic="";
    $errmsg=$errmsg."<Br>"."主题不应为空";
  }
}
  else
if (strlen($topic)>255)
{
  $founderror=true;
  if (!isset($errmsg))
  {
    $errmsg="主题长度不能超过255";
  }
    else
  {
    $errmsg=$errmsg+"<Br>"."主题长度不能超过255";
  }
}
if (strlen($body)>$ANNOUNCE_MAXBYTE)
{
  $errmsg=$errmsg."<Br>"."发言内容不得大于".$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;
}
?>
<?php
if ($founderror==TRUE)
{
showAnnounce($errmsg);
}
  else
{
 //####################################################
 $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_email=$v_info["email"];
  }
  else
  {
  $founduser=FALSE;
  }
    if ($founderror==TRUE)
    {
    showAnnounce($errmsg);
    exit();
    }
    else
    {
    $v_article=$v_info["article"]+1;
    mysql_query("UPDATE zmis41197 set article=".$v_article." where studentnumber='".$userid."'",$conn);
    }
 }
 //####################################################
  if ($founderror==FALSE)
  {
  $datetimestr=strftime('%Y-%m-%d %H:%M:%S %p');
  $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"];
   $insertsql='insert into guestbook(mastersn,parentid,child,vnickname,email,topic,body,dateandtime,hits,length,rootid,layer,orders,ip,expression,vnumber)values('.$userid.',0,0,"'.$v_nickname.'","'.$v_email.'","'.$topic.'","'.$body.'","'.$datetimestr.'",0,'.strlen($body).',0,1,0,"'.$ip.'","'.$expression.'","'.$v_number.'")';
    mysql_query($insertsql,$conn);
    $recordid=mysql_insert_id($conn);
    //echo $recordid."<br>";
    $select2="select * from guestbook where id=".$recordid;
    $query=mysql_query($select2,$conn);
    //$textid=mysql_data_seek($query,$recordid-1);
    //echo $textid."<br>";
    $array=mysql_fetch_array($query);
    $announceid=$array["id"];
    $updatesql="update guestbook set rootid=".$announceid." where id=".$announceid;
    $execute=mysql_query($updatesql,$conn);
      echo "<p align='center'><strong>";
      echo htmlspecialchars($topic);
      echo "</strong></p> ".chr(13).chr(10);
      echo "<hr noshade 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 htmlspecialchars($v_nickname);
        echo " 于 ".$datetimestr." 发表在:";
        echo "<strong>".$master_nickname_session."</strong>";
        echo "</p>".chr(13).chr(10);
      }
      echo "<p> ";
      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,$userid,$master_nickname_session,$topic,$body;
  echo "<div align='center'><font color='red'><strong>输入错误:</strong></font>".$errmsg."<div><BR>".chr(13).chr(10);
?>
<?php

?>
<form action="saveannounce.php?userid=<?php echo $userid;?>" method="POST"
name="frmAnnounce">
  <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>&nbsp;<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>&nbsp;
                    </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">
                  &nbsp;
                  <input class="buttonface" type="reset" value=" 重 填 " name="reset">
                  </span></td>
              </tr>
            </table>
      </td>
    </tr>
  </table>
  </center></div>
</form>
<?php
}
?>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -