国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

一個簡易需要注冊的留言版程序

2024-05-04 23:01:50
字體:
來源:轉載
供稿:網友
1.guestbook.php(留言程序)
<html>
<head>
<script language="javascript">
<!--
<!--
    var hellotext="為了您的最佳瀏覽效果請您使用ie4.0以上的版本和800*600分辨率"
    var thetext=""
    var started=false
    var step=0
    var times=1

    function welcometext()
    {
      times--
      if (times==0)
      {
        if (started==false)
        {
          started = true;
          window.status = hellotext;
          settimeout("anim()",1);
        }
        thetext = hellotext;
      }
    }

    function showstatustext(txt)
    {
      thetext = txt;
      settimeout("welcometext()",4000)
      times++
    }

    function anim()
    {
      step++
      if (step==7) {step=1}
      if (step==1)
{window.status='>==='+thetext+'===<'}
      if (step==2)
{window.status='=>=='+thetext+'==<='}
      if (step==3)
{window.status='>=>='+thetext+'=<=<'}
      if (step==4)
{window.status='=>=>'+thetext+'<=<='}
      if (step==5)
{window.status='==>='+thetext+'=<=='}
      if (step==6)
{window.status='===>'+thetext+'<==='}
      settimeout("anim()",200);
    }
  // -->
welcometext();

function mm_jumpmenu(targ,selobj,restore){ //v3.0
  eval(targ+".location='"+selobj.options[selobj.selectedindex].value+"'");
  if (restore) selobj.selectedindex=0;
}
//-->
</script>
<title>天地網絡留言版</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<style type="text/css">
<!--
a:link {  font-size: 9pt; color: #ffffff}
-->
</style>
<body>
<?
$pagesize=5;
$db=mysql_connect("localhost","root","");
mysql_select_db("lyanban",$db);
$result=mysql_query("select * from message order by date desc",$db);
$rowcount=mysql_num_rows($result);
$pages=ceil($rowcount/$pagesize);
if($rowcount==0)
{echo "目前沒有留言!<a href=guestbook.htm>歡迎您留言!</a>";}

if($rownum == "")
{
$rownum = 1;

}
$aa=ceil($rownum/5);
$i=0 ;
echo "<table width=100%><td><div align=center><font size=2 color=#000000><b>共有留言:$rowcount 條     共:$pages 頁        <right>現在是第 $aa 頁</right></b></font></div></td>";
echo "<hr size=1 color=#ccccff  width=75%>";
while ($myrow=mysql_fetch_array($result)){
$i++;
      if(($i>=$rownum)&&($i<$rownum+5)){
     echo "<table width=75% border=1 cellspacing=0 cellpadding=0 align=center bordercolordark=#ffffff bordercolorlight=#000000 background=15.jpg>";
     echo "<tr><td width=15%><div align=center><font size=2 color=#ffffff>姓  名</font></div></td><td width=85%><font size=2 color=#ffffff>$myrow[username]</font></td></tr>";
     echo "<tr><td width=15%><div align=center><font size=2 color=#ffffff>電子信箱</font></div></td><td width=85%><font size=2 color=#ffffff><a href="mailto:$myrow[email]">$myrow[email]</font></a></td></tr>";
     echo "<tr><td width=15%><div align=center><font size=2 color=#ffffff>公司主頁</font></div></td><td width=85%><font size=2 color=#ffffff><a href=$myrow[homepage] target=_blank>$myrow[homepage]</font></a></td></tr>";
     echo "<tr><td width=15%><div align=center><font size=2 color=#ffffff>留言主題</font></div></td><td width=85%><font size=2 color=#ffffff>$myrow[topic]</font></td></tr>";
     echo "<tr><td width=15%><div align=center><font size=2 color=#ffffff>留言內容</font></div></td><td width=85%><font size=2 color=#ffffff>$myrow[content]</font></td></tr>";
     echo "<tr><td width=15%><div align=center><font size=2 color=#ffffff>留言時間</font></div></td><td width=85%><font size=2 color=#ffffff>$myrow[date]</font></td></tr>";
     echo "</table><hr size=1 color=#ccccff  width=75%>";}
    }
echo "<table width=100%><tr><td width=87%>";
#判斷是否有上一頁或下一頁(10行換頁)

  echo "<form name="hiddenform" method="post" action="guestbook.php">";
  echo "<div align=center><input type="hidden" name="rownum" value="">";
  echo "<input type="hidden" name="rowcount" value="$rowcount">";
#顯示上一頁
  if ($rownum>=5)
          echo "<input type="submit" value="上一頁" .($rownum-5)."">";
#顯示下一頁
  if ($rownum+5<=$rowcount) {
          echo "<input type="submit" value="下一頁" .($rownum+5).""></div>";
          }
  echo "</form>";
  echo "</td>";
  echo "</tr>";
  echo "</table>";
  echo "<table width=100% ><tr><td><div align=center><font color=#ffffff size=2><a href=guestbook.htm>返回繼續發言</a></font></div></td></tr></table>";
?>
</body>
</html>
2.show.php3(顯示程序)
?
   $username = htmlspecialchars(ltrim(stripslashes (trim($name))));//   本函式可去掉字串中的反斜線空格字元
   $email = htmlspecialchars(ltrim(stripslashes (trim($email))));
   $homepage = htmlspecialchars(ltrim(stripslashes (trim($homepage))));
   $topic = htmlspecialchars(ltrim(stripslashes (trim($topic))));
   $content = htmlspecialchars(ltrim(stripslashes (trim($content))));
  // $content=base64_encode($content);
//send email
//  if ($ok) mail($email,$topic,$content);
   if (($username=="")or($topic=="")or(strlen($username)>20)or(strlen($topic)>20))
   {echo "請填寫必要的項目或著非法用戶名!<a href=javascript:history.go(-1);>返回</a>";
   }
   //wrong email ?
   elseif (($email!="")and(!eregi("^[_.0-9a-z-][email protected]([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$",$email)))
   {
    echo "請您填寫正確的 e-mail 地址</p><p align=center><a href=javascript:history.go(-1);>返回</a>";
   }
   //wrong homepage ?
   elseif (($homepage!="")and(!eregi("(http://)+[0-9a-z-]+.([0-9a-z-]+.)+[a-z]{2,3}$",$homepage)))
   {echo "主頁地址輸入錯誤!<a href=javascript:history.go(-1);>返回</a>";}
   else{
       //聯接數據庫
      mysql_connect("localhost","root","");
      mysql_select_db("lyanban");
      $sql="select password from tb where username='$username'";
      $result=mysql_query($sql);
      $nums=mysql_num_rows($result);
      if($nums!=1){
      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">
              <input type="reset" value="全部重寫" name="b2">
            </div>
          </td>
        </tr>
      </table>
  </form>
    </center>
  </div>
  <p> </p>
  <p> </p>

</body>

</html>
2.注冊程序
<html>
<head>
<title>registe</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#ffffff">
<div align="center">
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>用戶注冊</p>
  <form method="post" action="zhuc.php">
    <p>用戶名:
      <input type="text" name="username">
    </p>
    <p>密碼:
      <input type="password" name="password">
    </p>
    <p>
      <input type="submit" name="submit" value="確定">
      <input type="reset" name="submit2" value="重來">
    </p>
  </form>
  <p>&nbsp;</p>
</div>
</body>
</html>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 尤溪县| 顺义区| 开平市| 五原县| 调兵山市| 交口县| 志丹县| 凤冈县| 天峨县| 潮安县| 蓬莱市| 福安市| 江阴市| 德阳市| 耒阳市| 香格里拉县| 桑植县| 崇义县| 项城市| 鹿泉市| 阳曲县| 祁阳县| 富裕县| 临高县| 沙洋县| 高陵县| 奎屯市| 息烽县| 台南县| 西安市| 琼中| 象州县| 宿州市| 乌兰县| 衡东县| 图木舒克市| 白河县| 青阳县| 翁源县| 原平市| 普安县|