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


Posted in PHP onOctober 09, 2006

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="image/logo.gif" width="243" height="60" alt="医学导航网" border="0"></a></td>
    <td height="62" width="66%">  
      <div align="center"><img src="image/note.gif" width="410" height="60"><img src="image/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>  
      > <a href="index.php" class="white12">留言簿</a>  
      > 添加留言</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%"> </td>
            <td rowspan="2" width="46%">选择一个自己喜欢的头像:<br>
              <img src="image/face/icon1.gif" width="32" height="32">  
              <input type="radio" name="face" value="1" checked>
              <img src="image/face/icon2.gif" width="32" height="32">  
              <input type="radio" name="face" value="2">
              <img src="image/face/icon3.gif" width="32" height="32">  
              <input type="radio" name="face" value="3">
              <img src="image/face/icon4.gif" width="32" height="32">  
              <input type="radio" name="face" value="4">
              <img src="image/face/icon5.gif" width="32" height="32">  
              <input type="radio" name="face" value="5">
              <img src="image/face/icon6.gif" width="32" height="32">  
              <input type="radio" name="face" value="6">
              <img src="image/face/icon7.gif" width="32" height="32">  
              <input type="radio" name="face" value="7">
              <img src="image/face/icon8.gif" width="32" height="32">  
              <input type="radio" name="face" value="8">
              <img src="image/face/icon9.gif" width="32" height="32">  
              <input type="radio" name="face" value="9">
              <img src="image/face/icon10.gif" width="32" height="32">  
              <input type="radio" name="face" value="10">
              <img src="image/face/icon11.gif" width="32" height="32">  
              <input type="radio" name="face" value="11">
              <img src="image/face/icon12.gif" width="32" height="32">  
              <input type="radio" name="face" value="12">
              <img src="image/face/icon13.gif" width="32" height="32">  
              <input type="radio" name="face" value="13">
              <img src="image/face/icon14.gif" width="32" height="32">  
              <input type="radio" name="face" value="14">
              <img src="image/face/icon15.gif" width="32" height="32">  
              <input type="radio" name="face" value="15">
              <img src="image/face/icon16.gif" width="32" height="32">  
              <input type="radio" name="face" value="16">
              <img src="image/face/icon17.gif" width="32" height="32">  
              <input type="radio" name="face" value="17">
              <img src="image/face/icon18.gif" width="32" height="32">  
              <input type="radio" name="face" value="18">
              <img src="image/face/icon19.gif" width="32" height="32">  
              <input type="radio" name="face" value="19">
              <img src="image/face/icon20.gif" width="32" height="32">  
              <input type="radio" name="face" value="20">
              <img src="image/face/icon21.gif" width="32" height="32">  
              <input type="radio" name="face" value="21">
              <img src="image/face/icon22.gif" width="32" height="32">  
              <input type="radio" name="face" value="22">
              <img src="image/face/icon23.gif" width="32" height="32">  
              <input type="radio" name="face" value="23">
              <img src="image/face/icon24.gif" width="32" height="32">  
              <input type="radio" name="face" value="24">
              <img src="image/face/icon25.gif" width="32" height="32">  
              <input type="radio" name="face" value="25">
              <img src="image/face/icon26.gif" width="32" height="32">  
              <input type="radio" name="face" value="26">
              <img src="image/face/icon27.gif" width="32" height="32">  
              <input type="radio" name="face" value="27">
              <img src="image/face/icon28.gif" width="32" height="32">  
              <input type="radio" name="face" value="28">
              <img src="image/face/icon29.gif" width="32" height="32">  
              <input type="radio" name="face" value="29">
              <img src="image/face/icon30.gif" width="32" height="32">  
              <input type="radio" name="face" value="30">
              <img src="image/face/icon31.gif" width="32" height="32">  
              <input type="radio" name="face" value="31">
              <img src="image/face/icon32.gif" width="32" height="32">  
              <input type="radio" name="face" value="32">
              <img src="image/face/icon33.gif" width="32" height="32">  
              <input type="radio" name="face" value="33">
              <img src="image/face/icon34.gif" width="32" height="32">  
              <input type="radio" name="face" value="34">
              <img src="image/face/icon35.gif" width="32" height="32">  
              <input type="radio" name="face" value="35">
              <img src="image/face/icon36.gif" width="32" height="32">  
              <input type="radio" name="face" value="36">
              <img src="image/face/icon37.gif" width="32" height="32">  
              <input type="radio" name="face" value="37">
              <img src="image/face/icon38.gif" width="32" height="32">  
              <input type="radio" name="face" value="38">
              <img src="image/face/icon39.gif" width="32" height="32">  
              <input type="radio" name="face" value="39">
              <img src="image/face/icon40.gif" width="32" height="32">  
              <input type="radio" name="face" value="40">
              <img src="image/face/icon41.gif" width="32" height="32">  
              <input type="radio" name="face" value="41">
              <img src="image/face/icon42.gif" width="32" height="32">  
              <input type="radio" name="face" value="42">
              <img src="image/face/icon43.gif" width="32" height="32">  
              <input type="radio" name="face" value="43">
              <img src="image/face/icon44.gif" width="32" height="32">  
              <input type="radio" name="face" value="44">
              <img src="image/face/icon45.gif" width="32" height="32">  
              <input type="radio" name="face" value="45">
              <img src="image/face/icon46.gif" width="32" height="32">  
              <input type="radio" name="face" value="46">
              <img src="image/face/icon47.gif" width="32" height="32">  
              <input type="radio" name="face" value="47">
              <img src="image/face/icon48.gif" width="32" height="32">  
              <input type="radio" name="face" value="48">
              <img src="image/face/icon49.gif" width="32" height="32">  
              <input type="radio" name="face" value="49">
              <img src="image/face/icon50.gif" width="32" height="32">  
              <input type="radio" name="face" value="50">
              <img src="image/face/icon51.gif" width="32" height="32">  
              <input type="radio" name="face" value="51">
              <img src="image/face/icon52.gif" width="32" height="32">  
              <input type="radio" name="face" value="52">
              <img src="image/face/icon53.gif" width="32" height="32">  
              <input type="radio" name="face" value="53">
              <img src="image/face/icon54.gif" width="32" height="32">  
              <input type="radio" name="face" value="54">
              <img src="image/face/icon55.gif" width="32" height="32">  
              <input type="radio" name="face" value="55">
              <img src="image/face/icon56.gif" width="32" height="32">  
              <input type="radio" name="face" value="56">
              <img src="image/face/icon57.gif" width="32" height="32">  
              <input type="radio" name="face" value="57">
              <img src="image/face/icon58.gif" width="32" height="32">  
              <input type="radio" name="face" value="58">
              <img src="image/face/icon59.gif" width="32" height="32">  
              <input type="radio" name="face" value="59">
              <img src="image/face/icon60.gif" width="32" height="32">  
              <input type="radio" name="face" value="60">
              <img src="image/face/icon61.gif" width="32" height="32">  
              <input type="radio" name="face" value="61">
              <img src="image/face/icon62.gif" width="32" height="32">  
              <input type="radio" name="face" value="62">
              <img src="image/face/icon63.gif" width="32" height="32">  
              <input type="radio" name="face" value="63">
              <img src="image/face/icon64.gif" width="32" height="32">  
              <input type="radio" name="face" value="64">
            </td>
          </tr>
          <tr>  
            <td width="54%">名字 
              <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="image/logo.gif" width="243" height="60" alt="医学导航网" border="0"></a></td>
    <td height="62" width="66%">  
      <div align="center"><img src="image/note.gif" width="410" height="60"><img src="image/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">首页  
            > <a href="index.php" class="white12">留言簿</a></td>
          <td width="56%" class="white12">  
            <?php
          echo "帖子总数:  ",$max,"   第";
          for ($n=1;$n<=$p;$n++){
          echo "<a href=index.php?page=$n>$n</a> ";
          }
          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'> <img src='$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='image/email.gif' width='16' height='16' border=0></a></td>";
echo        "<td width='21%' height='33' class='blue9'><img src='image/ip.gif' width='13' height='15'>  $ip <a href='$PHP_SELF?del=1&time=$time&superadmin=$superadmin&user=$user&psw=$psw'><img src='image/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>

PHP 相关文章推荐
第十三节--对象串行化
Nov 16 PHP
php下正则来匹配dede模板标签的代码
Aug 21 PHP
php 生成文字png图片的代码
Apr 17 PHP
第4章 数据处理-php正则表达式-郑阿奇(续)
Jul 04 PHP
php中设置多级目录session的问题
Aug 08 PHP
js限制checkbox勾选的个数以及php获取多个checkbbox的方法深入解析
Jul 18 PHP
PHP获取Exif缩略图的方法
Jul 13 PHP
PHP发送AT指令实例代码
May 26 PHP
PHP中CheckBox多选框上传失败的代码写法
Feb 13 PHP
php 从指定数字中获取随机组合的简单方法(推荐)
Apr 05 PHP
php批量删除操作(数据访问)
May 23 PHP
vmware linux系统安装最新的php7图解
Apr 14 PHP
一个ubbcode的函数,速度很快.
Oct 09 #PHP
PHP中动态HTML的输出技术
Oct 09 #PHP
也谈截取首页新闻 - 范例
Oct 09 #PHP
PHP4实际应用经验篇(6)
Oct 09 #PHP
PHP4实际应用经验篇(7)
Oct 09 #PHP
PHP4实际应用经验篇(9)
Oct 09 #PHP
PHP4实际应用经验篇(8)
Oct 09 #PHP
You might like
PHP生成月历代码
2007/06/14 PHP
PHP页面间传递参数实例代码
2008/06/05 PHP
注意!PHP 7中不要做的10件事
2016/09/18 PHP
作为PHP程序员你要知道的另外一种日志
2018/07/30 PHP
php+websocket 实现的聊天室功能详解
2020/05/27 PHP
起点页面传值js,有空研究学习下
2010/01/25 Javascript
通过JS获取用户本地图片路径并显示的代码
2012/02/16 Javascript
Javascript页面跳转常见实现方式汇总
2015/11/28 Javascript
Bootstrap每天必学之轮播(Carousel)插件
2016/04/25 Javascript
Yarn的安装与使用详细介绍
2016/10/25 Javascript
JavaScript自定义浏览器滚动条兼容IE、 火狐和chrome
2017/01/05 Javascript
基于JavaScript实现淘宝商品广告效果
2017/08/10 Javascript
jQuery操作元素追加内容示例
2020/01/10 jQuery
Vue中添加滚动事件设置的方法详解
2020/09/14 Javascript
python将xml xsl文件生成html文件存储示例讲解
2013/12/03 Python
Python实现命令行通讯录实例教程
2016/08/18 Python
json跨域调用python的方法详解
2017/01/11 Python
浅谈Python中的私有变量
2018/02/28 Python
对dataframe进行列相加,行相加的实例
2018/06/08 Python
对python创建及引用动态变量名的示例讲解
2018/11/10 Python
Python中变量的输入输出实例代码详解
2019/07/28 Python
python利用itertools生成密码字典并多线程撞库破解rar密码
2019/08/12 Python
python 中xpath爬虫实例详解
2019/08/26 Python
Python 最强编辑器详细使用指南(PyCharm )
2019/09/16 Python
Python基础教程之输入输出和运算符
2020/07/26 Python
基于Django快速集成Echarts代码示例
2020/12/01 Python
selenium与xpath之获取指定位置的元素的实现
2021/01/26 Python
税务专业毕业生自荐信
2013/11/10 职场文书
测量工程专业求职信
2014/02/24 职场文书
新闻专业毕业生英文求职信
2014/03/19 职场文书
国旗下的演讲稿
2014/05/08 职场文书
入党积极分子学习党的纲领思想汇报
2014/09/13 职场文书
司机岗位职责
2015/02/04 职场文书
中学生综合素质自我评价
2015/03/06 职场文书
餐厅收银员岗位职责
2015/04/07 职场文书
一定要知道的 25 个 Vue 技巧
2021/11/02 Vue.js