4221学习网
首页 | 网址大全 | 脑力倍增 | 电脑学院 | 学习方法 | 英语学习 | 口才交际 | 工作职场 | 成功励志 | 文学小说 | 视频教程 | 视频短片 | 下载中心 | NBA | 奥运 | 图片专区 | QQ·技巧 | 游戏技巧 | 恋爱技巧 | 谈天说地 | 专题教程 | 4221论坛
热门关键字: 视频教程  百家讲坛  美女  记忆力  疯狂英语
 → 当前位置:4221学习网>电脑学院>编程开发>PHP教程>正文

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

4221学习网 2007-06-08 来源:互联网 收藏本文

训练30小时,让阅读提速5-10倍!---速读记忆训练软件免费下载!(点击下载)

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="上一页" onclick="document.hiddenform.rownum.value=".($rownum-5)."">";
#显示下一页
  if ($rownum+5<=$rowcount) {
          echo "<input type="submit" value="下一页" onclick="document.hiddenform.rownum.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-]+@([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'";

共3页: 上一页 1 [2] [3] 下一页
上一篇:用php实现广告轮播   下一篇:PHP空白页面常见原因及解决方法
添加到google书签 digg this! 添加到bolaa 添加到yahoo+ 添加到新浪vivi 添加到365key  
收藏】 【评论】 【推荐】 【投稿】 【打印】 【关闭

相关文章
·用php实现广告轮播
·PHP空白页面常见原因及解决方法
·PHP编程常用技巧四则
·PHP5中PDO的简单使用
·跟我来学PHP5:session会话的使用和分析
·十天学会php之第十天
·十天学会php之第九天
·十天学会php之第八天
·十天学会php之第七天
·十天学会php之第六天
发表评论
要记得去论坛讨论,点击注册新会员) 密码: 匿名评论
评论内容:(请自觉遵守互联网相关政策法规。)
最新文章
·十天学会php之第一天
·十天学会php之第二天
·十天学会php之第三天
·十天学会php之第四天
·十天学会php之第五天
·十天学会php之第六天
·十天学会php之第七天
·十天学会php之第八天
·十天学会php之第九天
·十天学会php之第十天
本类阅读排行榜
·跟我来学PHP5:session会话的使用和分析
·PHP5中PDO的简单使用
·PHP空白页面常见原因及解决方法
·十天学会php之第一天
·用php实现广告轮播
·十天学会php之第九天
·十天学会php之第五天
·PHP编程常用技巧四则
·十天学会php之第八天
·十天学会php之第四天
热点视频教程
视频街舞 舞步 教学
视频windowsxp重装系统视频教程
视频李孝利十分钟详细舞蹈教程
视频美女教你跳舞
视频街舞 舞步 教学2
视频双截棍视频教程-定式
视频如何安装双操作系统
视频韩国的太空步教程,后滑、侧滑、旋转太空
视频【WindowsXP入门教程】 - 硬盘分区
视频台球教程-基本杆法
视频[百家讲坛]三十六计01_借刀杀人
视频24式太极拳教学---基本动作
视频 斯诺克台球竿法-后退球
视频动物世界之决战生死线2
视频超级全脑速读训练教程

设为首页 - 加入收藏 - 关于我们 - 联系我们 - 友情连接

4221学习网版权所有-鄂ICP备07006816号
已浏览: