您现在的位置: 军旅同心 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 文章正文
一个简易需要注册的留言版程序
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:36:14
;  echo"对不起!请先<a href=register.html>注册</a>!";
      }
      else{
      //得到日期 YYYY-MM-DD HH:MM:SS 2000-01-01 00:00:00'
      $t = date(Y."-".m."-".d." ".H.":".i.":".s);
     //将新用户插入数据库
     mysql_query("insert into message values ('$username','$email','$homepage','$topic','$content','$t')");
     echo "<div align=center><font size=2 color=#000000>谢谢您留言!您的留言已成功加入,<a href=guestbook.php>返回</a></font></div>";
     }
     }
?>
3.zhuc.php(注册程序)
<?
mysql_connect("localhost","root","")
or die("无法连接数据库,请重试");

mysql_select_db("lyanban")
or die("无法选择数据库,请重试");
$query="select password from tb where username='$username'";
$result=mysql_query($query);
$numrows=mysql_num_rows($result);
if($numrows!=0)
{echo '已有人注册此名,请重新选择名字!<a href=javascript:history.go(-1);>返回</a>';}
else
{$query="insert into tb(username,password) values('$username','$password')";
mysql_query($query);
echo '注册成功';
echo '<A HREF="guestbook.htm" >请登录!</A>';}
?>
以下是两个配套的HTML:
1。留言网页
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>天地网络留言版欢迎您留言!</title>
</head>
<body bgcolor="#FFFFFF">
<div align="center">
    <center>
    <br>
    <font size="2">天地网络留言版测试版</font><br>
    <br>
    <form method="post" action="show.php3">
      <table width="66%">
        <tr>
          <td width="50%" height="1">
            <div align="center"> <font size="2">          您的尊姓大名:</font></div>
          </td>
          <td width="50%" height="1">
            <div align="center">
              <input type="text" name="name" size="20">
            </div>
          </td>
        </tr>
        <tr>
          <td width="50%" height="1">
            <div align="center"><font size="2">          您的电子邮件地址:</font></div>
          </td>
          <td width="50%" height="1">
            <div align="center">
              <input type="text" name="email" size="20">
            </div>
          </td>
        </tr>
        <tr>
          <td width="50%" height="1">
            <div align="center"><font size="2">         您的公司主页地址:</font></div>
          </td>
          <td width="50%" height="1">
            <div align="center">
              <input type="text" name="homepage" size="20" value="http://">
            </div>
          </td>
        </tr>
        <tr>
          <td width="50%" height="1">
            <div align="center">           <font size="2">留言主题:</font></div>
          </td>
          <td width="50%" height="1" valign="middle">
            <div align="center">
              <input type="text" name="topic" size="20">
            </div>
          </td>
        </tr>
        <tr>
          <td width="50%" height="1">
            <div align="center">            <font size="2">留言内容:</font></div>
          </td>
          <td width="50%" height="1">
            <div align="center"> </div>
          </td>
        </tr>
        <tr>
          <td width="100%" colspan="2" height="66">
            <p align="center">
              <textarea rows="10" name="content" cols="50"></textarea>
            </p>
          </td>
        </tr>
        <tr>
          <td width="50%" height="18">
            <div align="center"></div>
          </td>
          <td width="50%" height="18">
            <div align="center"></div>
          </td>
        </tr>
        <tr>
          <td width="50%" height="18" align="center">
            <p align="center">
              <input type="submit" value="发表留言" name="B1">
            </p>
          </td>
          <td width="50%" height="18" align="center">
            <div align="center">
 

上一页  [1] [2] [3] 下一页


 
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 |