首页 > 开发 > PHP > 正文

支持oicq头像的留言簿(二)

2024-05-04 23:01:28
字体:
来源:转载
供稿:网友
菜鸟学堂:
addnote.php
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>添加留言</title>
<style type="text/css">
<!--
.white12 {  font-size: 12pt; color: #ffffff; text-decoration: none}
-->
</style>
</head>
<body bgcolor="#ffffff">
<table width="98%" border="0" cellspacing="0" cellpadding="0" height="61">
  <tr>  
    <td height="62" width="34%"><a href="http://www.medguider.com"><img src="http://edu.cnzz.cn/newsinfo/upload/200902/logo.gif" width="243" height="60" alt="医学导航网" border="0"></a></td>
    <td height="62" width="66%">  
      <div align="center"><img src="http://edu.cnzz.cn/newsinfo/upload/200902/note.gif" width="410" height="60"><img src="http://edu.cnzz.cn/newsinfo/upload/200902/y1.gif" width="60" height="60"></div>
    </td>
  </tr>
</table>
<?php
include ("config.php");
if ($submit){
$time=date("y年m月d日 h:i:s a");
$ip=$remote_addr;//留言人ip地址
$name=trim($name);
$email=trim($email);
$title=strip_tags($top);
$nnote=nl2br(strip_tags($content));//先去掉html标记,再将换行符转成 <br>。
if (!$name||!$email||!$title||!$nnote){           //检查是否填写完整
      echo "对不起,您必须填所有内容!<br>"."<a href='javascript:history.back()'>返回</a>";
      exit; }elseif(!ereg('^[-!#$%&'*+./0-9=?a-z^_`a-z{|}~]+'.'@'.'[-!#$%&'*+//0-9=?a-z^_`a-z{|}~]+.'.'[-!#$%&'*+/./0-9=?a-z^_`a-z{|}~]+$',$email)  //email合法性验证
       ){
       echo "email不合法!<br>"."<a href='javascript:history.back()'>返回</a>";
       exit;
             }
   //写入数据库
$sql="insert into notebook (name,email,time,face,ip,title,nnote) values ('$name','$email','$time','$face','$ip','$title','$nnote')";
$result = mysql_query($sql,$db);
mysql_close($db);
echo "留言成功!";
}
?>
<table width="99%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolor="#3366ff">
  <tr bgcolor="#3366ff">  
    <td width="81%" class="white12" height="26"><a href="../index.php" class="white12">首页</a>  
      &gt; <a href="index.php" class="white12">留言簿</a>  
      &gt; 添加留言</td>
    <td width="19%" class="white12" height="26"><a href='index.php' class="white12">查看留言</a>  
    </td>
  </tr>
  <tr>  
    <td colspan="2">
      <form name="form1" method="post" action="addnote.php">
        <table width="99%" border="0" cellspacing="0" cellpadding="0">
          <tr>  
            <td width="54%">&nbsp;</td>
            <td rowspan="2" width="46%">选择一个自己喜欢的头像:<br>
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon1.gif" width="32" height="32">  
              <input type="radio" name="face" value="1" checked>
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon2.gif" width="32" height="32">  
              <input type="radio" name="face" value="2">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon3.gif" width="32" height="32">  
              <input type="radio" name="face" value="3">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon4.gif" width="32" height="32">  
              <input type="radio" name="face" value="4">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon5.gif" width="32" height="32">  
              <input type="radio" name="face" value="5">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon6.gif" width="32" height="32">  
              <input type="radio" name="face" value="6">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon7.gif" width="32" height="32">  
              <input type="radio" name="face" value="7">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon8.gif" width="32" height="32">  
              <input type="radio" name="face" value="8">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon9.gif" width="32" height="32">  
              <input type="radio" name="face" value="9">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon10.gif" width="32" height="32">  
              <input type="radio" name="face" value="10">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon11.gif" width="32" height="32">  
              <input type="radio" name="face" value="11">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon12.gif" width="32" height="32">  
              <input type="radio" name="face" value="12">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon13.gif" width="32" height="32">  
              <input type="radio" name="face" value="13">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon14.gif" width="32" height="32">  
              <input type="radio" name="face" value="14">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon15.gif" width="32" height="32">  
              <input type="radio" name="face" value="15">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon16.gif" width="32" height="32">  
              <input type="radio" name="face" value="16">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon17.gif" width="32" height="32">  
              <input type="radio" name="face" value="17">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon18.gif" width="32" height="32">  
              <input type="radio" name="face" value="18">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon19.gif" width="32" height="32">  
              <input type="radio" name="face" value="19">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon20.gif" width="32" height="32">  
              <input type="radio" name="face" value="20">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon21.gif" width="32" height="32">  
              <input type="radio" name="face" value="21">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon22.gif" width="32" height="32">  
              <input type="radio" name="face" value="22">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon23.gif" width="32" height="32">  
              <input type="radio" name="face" value="23">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon24.gif" width="32" height="32">  
              <input type="radio" name="face" value="24">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon25.gif" width="32" height="32">  
              <input type="radio" name="face" value="25">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon26.gif" width="32" height="32">  
              <input type="radio" name="face" value="26">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon27.gif" width="32" height="32">  
              <input type="radio" name="face" value="27">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon28.gif" width="32" height="32">  
              <input type="radio" name="face" value="28">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon29.gif" width="32" height="32">  
              <input type="radio" name="face" value="29">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon30.gif" width="32" height="32">  
              <input type="radio" name="face" value="30">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon31.gif" width="32" height="32">  
              <input type="radio" name="face" value="31">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon32.gif" width="32" height="32">  
              <input type="radio" name="face" value="32">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon33.gif" width="32" height="32">  
              <input type="radio" name="face" value="33">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon34.gif" width="32" height="32">  
              <input type="radio" name="face" value="34">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon35.gif" width="32" height="32">  
              <input type="radio" name="face" value="35">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon36.gif" width="32" height="32">  
              <input type="radio" name="face" value="36">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon37.gif" width="32" height="32">  
              <input type="radio" name="face" value="37">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon38.gif" width="32" height="32">  
              <input type="radio" name="face" value="38">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon39.gif" width="32" height="32">  
              <input type="radio" name="face" value="39">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon40.gif" width="32" height="32">  
              <input type="radio" name="face" value="40">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon41.gif" width="32" height="32">  
              <input type="radio" name="face" value="41">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon42.gif" width="32" height="32">  
              <input type="radio" name="face" value="42">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon43.gif" width="32" height="32">  
              <input type="radio" name="face" value="43">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon44.gif" width="32" height="32">  
              <input type="radio" name="face" value="44">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon45.gif" width="32" height="32">  
              <input type="radio" name="face" value="45">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon46.gif" width="32" height="32">  
              <input type="radio" name="face" value="46">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon47.gif" width="32" height="32">  
              <input type="radio" name="face" value="47">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon48.gif" width="32" height="32">  
              <input type="radio" name="face" value="48">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon49.gif" width="32" height="32">  
              <input type="radio" name="face" value="49">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon50.gif" width="32" height="32">  
              <input type="radio" name="face" value="50">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon51.gif" width="32" height="32">  
              <input type="radio" name="face" value="51">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon52.gif" width="32" height="32">  
              <input type="radio" name="face" value="52">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon53.gif" width="32" height="32">  
              <input type="radio" name="face" value="53">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon54.gif" width="32" height="32">  
              <input type="radio" name="face" value="54">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon55.gif" width="32" height="32">  
              <input type="radio" name="face" value="55">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon56.gif" width="32" height="32">  
              <input type="radio" name="face" value="56">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon57.gif" width="32" height="32">  
              <input type="radio" name="face" value="57">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon58.gif" width="32" height="32">  
              <input type="radio" name="face" value="58">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon59.gif" width="32" height="32">  
              <input type="radio" name="face" value="59">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon60.gif" width="32" height="32">  
              <input type="radio" name="face" value="60">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon61.gif" width="32" height="32">  
              <input type="radio" name="face" value="61">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon62.gif" width="32" height="32">  
              <input type="radio" name="face" value="62">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon63.gif" width="32" height="32">  
              <input type="radio" name="face" value="63">
              <img src="http://edu.cnzz.cn/newsinfo/upload/200902/face/icon64.gif" width="32" height="32">  
              <input type="radio" name="face" value="64">
            </td>
          </tr>
          <tr>  
            <td width="54%">名字&nbsp;
              <input type="text" name="name">
              <br>
              email  
              <input type="text" name="email">
              <br>
              标题  
              <input type="text" name="top" size="50">
              <br>
              内容<br>
              <textarea name="content" cols="50" rows="20"></textarea>
            </td>
          </tr>
          <tr>  
            <td colspan="2">  
              <div align="center">
                <input type="submit" name="submit" value="确定">
                <input type="reset" name="cancel" value="重写">
              </div>
            </td>
          </tr>
        </table>
              </form>
    </td>
  </tr>
</table>
<p><a href="main.php?user=<? echo $user?>" class="white12"><br>
  </a></p>
</body>
</html>
delnote.php
<?php
include ("config.php");
if ($superadmin){      //如果已经进行管理员登陆,进行密码验证
if (!($user==$username)||!($psw==$password)){  
echo "密码错误";
exit;
}
}else{              //管理员登陆
echo "<form name='form1' method='post' action='$php_self'>";
echo "<div align='center'> 请输入管理员密码<br>";
echo "管理员";  
echo "<input type='text' name='user'><br>";
echo "密码";
echo "<input type='password' name='psw'><br>";
echo "<input type='submit' name='superadmin' value='进入'><br>";
echo "<input type='reset' name='cancel' value='重写'></div>";   
echo "</form>";
exit;
}
if($del==1){       //判断是否要删除
mysql_query("delete from notebook where time='$time'",$db); //以留言时间为删除标志
echo "删除成功!";
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>删除留言</title>
<style type="text/css">
<!--
.blue9 {  font-size: 9pt; color: #0099ff; text-decoration: none}
.black9 {  font-size: 9pt; text-decoration: none}
.purple10 {  font-size: 10pt; color: #9900ff; text-decoration: none}
.white12 {  font-size: 12pt; color: #ffffff; text-decoration: none}
a:visited {  color: #ffffff}
a:link {  color: #ffffff}
-->
</style>
</head>
<body bgcolor="#ffffff">
<?php
$result = mysql_query("select * from notebook ",$db);
$row=mysql_num_rows($result);//查看结果有多少行
$max=$row; //帖子总数
//设每页显示10篇,$p总页数,$page第几页,$low 从第几行开始读,$x 读取几行
if (!$page){$page=1;}
$p=ceil($max/10);
$low=10*($page-1);
if($page==$p&&($max%10)<>0){$x=($max%10);} else {$x=10;}//如果是最后一页,且不是10的整倍数,读取$max除以10的余数,否则取10
if($max==0){$x=0;}//如果没有帖子,$x取0
$result = mysql_query("select * from notebook order by time desc limit $low,$x",$db);
?>
<table width="98%" border="0" cellspacing="0" cellpadding="0" height="61">
  <tr>  
    <td height="62" width="34%"><a href="http://www.medguider.com"><img src="http://edu.cnzz.cn/newsinfo/upload/200902/logo.gif" width="243" height="60" alt="医学导航网" border="0"></a></td>
    <td height="62" width="66%">  
      <div align="center"><img src="http://edu.cnzz.cn/newsinfo/upload/200902/note.gif" width="410" height="60"><img src="http://edu.cnzz.cn/newsinfo/upload/200902/y1.gif" width="60" height="60"></div>
    </td>
  </tr>
</table>
<table width="95%" border="1" cellspacing="0" cellpadding="0" height="253" bordercolordark="#ffffff" bordercolorlight="#003399" align="center">
  <tr>  
    <td height="250">
      <table width="95%" border="0" cellspacing="0" cellpadding="0" height="32" bgcolor="#3366ff">
        <tr>  
          <td width="28%" class="white12">首页  
            &gt; <a href="index.php" class="white12">留言簿</a></td>
          <td width="56%" class="white12">  
            <?php
          echo "帖子总数: &nbsp;",$max," &nbsp;&nbsp;第";
          for ($n=1;$n<=$p;$n++){
          echo "<a href=index.php?page=$n>$n</a>&nbsp;";
          }
          echo "页";
          ?>
          </td>
          <td width="16%"><a href="index.php" class="white12">查看留言</a></td>
        </tr>
      </table>  
<?php
   for ($i=0;$i<=($x-1);$i++) {
   $email=mysql_result($result,$i,'email');
   $face=mysql_result($result,$i,'face');
   $face='image/face/icon'.$face;
   $name=mysql_result($result,$i,'name');
   $time=mysql_result($result,$i,'time');
   $ip=mysql_result($result,$i,'ip');
   $title=mysql_result($result,$i,'title');
   $nnote=mysql_result($result,$i,'nnote');
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' height=107' bordercolor='#ffffff'> <tr bgcolor='#eeeeee'>";  
echo "<td width='10%' height='33' bgcolor='#eeeeee' class='blue9'>&nbsp;<img src='http://edu.cnzz.cn/newsinfo/$face.gif' width='32' height='32'></td>";
echo        "<td width='16%' height='33' bgcolor='#eeeeee' class='blue9'>留言人:$name</td>";
echo        "<td width='41%' height='33' bgcolor='#eeeeee' class='blue9'>发表于:$time</td>";
echo        "<td width='12%' height='33' bgcolor='#eeeeee' class='blue9'><a href='mailto:$email'><img src='http://edu.cnzz.cn/newsinfo/upload/200902/email.gif' width='16' height='16' border=0></a></td>";
echo        "<td width='21%' height='33' class='blue9'><img src='http://edu.cnzz.cn/newsinfo/upload/200902/ip.gif' width='13' height='15'> &nbsp;$ip <a href='$php_self?del=1&time=$time&superadmin=$superadmin&user=$user&psw=$psw'><img src='http://edu.cnzz.cn/newsinfo/upload/200902/del.gif' width='16' height='16' border=0></a></td>  </tr> <tr>";  
echo        "<td colspan='5' class='purple10' height='33'>标题:$title</td> </tr>";
echo        "<tr bgcolor='#ffffff'><td colspan='5' class='black9' height='37'>留言内容:$nnote</td></tr></table>";
}
mysql_close($db);
?>     
    </td>
</tr>
</table>
</body>
</html>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表