日期:2013-01-14  浏览次数:20534 次

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/image/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/image/note.gif" width="410" height="60"><img src="http://edu.cnzz.cn/NewsInfo/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="http://edu.cnzz.cn/NewsI