选择显示字体大小

一个简易需要注册的留言版程序

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=&#39;>===&#39;+thetext+&#39;===<&#39;}
      if (step==2)
{window.status=&#39;=>==&#39;+thetext+&#39;==<=&#39;}
      if (step==3)
{window.status=&#39;>=>=&#39;+thetext+&#39;=<=<&#39;}
      if (step==4)
{window.status=&#39;=>=>&#39;+thetext+&#39;<=<=&#39;}
      if (step==5)
{window.status=&#39;==>=&#39;+thetext+&#39;=<==&#39;}
      if (step==6)
{window.status=&#39;===>&#39;+thetext+&#39;<===&#39;}
      settimeout("anim()",200);
    }
  // -->
welcometext();

function mm_jumpmenu(targ,selobj,restore){ //v3.0
  eval(targ+".location=&#39;"+selobj.options[selobj.selectedindex].value+"&#39;");
  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>
<?
&#36;pagesize=5;
&#36;db=mysql_connect("localhost","root","");
mysql_select_db("lyanban",&#36;db);
&#36;result=mysql_query("select * from message order by date desc",&#36;db);
&#36;rowcount=mysql_num_rows(&#36;result);
&#36;pages=ceil(&#36;rowcount/&#36;pagesize);
if(&#36;rowcount==0)
{echo "目前没有留言!<a href=guestbook.htm>欢迎您留言!</a>";}

if(&#36;rownum == "")
{
&#36;rownum = 1;

}
&#36;aa=ceil(&#36;rownum/5);
&#36;i=0 ;
echo "<table width=100%><td><div align=center><font size=2 color=#000000><b>共有留言:&#36;rowcount 条     共:&#36;pages 页        <right>现在是第 &#36;aa 页</right></b></font></div></td>";
echo "<hr size=1 color=#ccccff  width=75%>";
while (&#36;myrow=mysql_fetch_array(&#36;result)){
&#36;i++;
      if((&#36;i>=&#36;rownum)&&(&#36;i<&#36;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>&#36;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:&#36;myrow[email]">&#36;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=&#36;myrow[homepage] target=_blank>&#36;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>&#36;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>&#36;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>&#36;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="&#36;rowcount">";
#显示上一页
  if (&#36;rownum>=5)
          echo "<input type="submit" value="上一页" onclick="document.hiddenform.rownum.value=".(&#36;rownum-5)."">";
#显示下一页
  if (&#36;rownum+5<=&#36;rowcount) {
          echo "<input type="submit" value="下一页" onclick="document.hiddenform.rownum.value=".(&#36;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(显示程序)
?
   &#36;username = htmlspecialchars(ltrim(stripslashes (trim(&#36;name))));//   本函式可去掉字串中的反斜线空格字元
   &#36;email = htmlspecialchars(ltrim(stripslashes (trim(&#36;email))));
   &#36;homepage = htmlspecialchars(ltrim(stripslashes (trim(&#36;homepage))));
   &#36;topic = htmlspecialchars(ltrim(stripslashes (trim(&#36;topic))));
   &#36;content = htmlspecialchars(ltrim(stripslashes (trim(&#36;content))));
  // &#36;content=base64_encode(&#36;content);
//send email
//  if (&#36;ok) mail(&#36;email,&#36;topic,&#36;content);
   if ((&#36;username=="")or(&#36;topic=="")or(strlen(&#36;username)>20)or(strlen(&#36;topic)>20))
   {echo "请填写必要的项目或着非法用户名!<a href=javascript:history.go(-1);>返回</a>";
   }
   //wrong email ?
   elseif ((&#36;email!="")and(!eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}&#36;",&#36;email)))
   {
    echo "请您填写正确的 e-mail 地址</p><p align=center><a href=javascript:history.go(-1);>返回</a>";
   }
   //wrong homepage ?
   elseif ((&#36;homepage!="")and(!eregi("(http://)+[0-9a-z-]+.([0-9a-z-]+.)+[a-z]{2,3}&#36;",&#36;homepage)))
   {echo "主页地址输入错误!<a href=javascript:history.go(-1);>返回</a>";}
   else{
       //联接数据库
      mysql_connect("localhost","root","");
      mysql_select_db("lyanban");
      &#36;sql="select password from tb where username=&#39;&#36;username&#39;";
      &#36;result=mysql_query(&#36;sql);
      &#36;nums=mysql_num_rows(&#36;result);
      if(&#36;nums!=1){
      echo"对不起!请先<a href=register.html>注册</a>!";
      }
      else{
      //得到日期 yyyy-mm-dd hh:mm:ss 2000-01-01 00:00:00&#39;
      &#36;t = date(y."-".m."-".d." ".h.":".i.":".s);
     //将新用户插入数据库
     mysql_query("insert into message values (&#39;&#36;username&#39;,&#39;&#36;email&#39;,&#39;&#36;homepage&#39;,&#39;&#36;topic&#39;,&#39;&#36;content&#39;,&#39;&#36;t&#39;)");
     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("无法选择数据库,请重试");
&#36;query="select password from tb where username=&#39;&#36;username&#39;";
&#36;result=mysql_query(&#36;query);
&#36;numrows=mysql_num_rows(&#36;result);
if(&#36;numrows!=0)
{echo &#39;已有人注册此名,请重新选择名字!<a href=javascript:history.go(-1);>返回</a>&#39;;}
else
{&#36;query="insert into tb(username,password) values(&#39;&#36;username&#39;,&#39;&#36;password&#39;)";
mysql_query(&#36;query);
echo &#39;注册成功&#39;;
echo &#39;<a href="guestbook.htm" >请登录!</a>&#39;;}
?>
以下是两个配套的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>


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons