• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當(dāng)前位置:雨林木風(fēng)下載站 > 技術(shù)開(kāi)發(fā)教程 > 詳細(xì)頁(yè)面

        一個(gè)可分頁(yè)的基于文本的PHP留言板

        一個(gè)可分頁(yè)的基于文本的PHP留言板

        更新時(shí)間:2020-02-09 文章作者:未知 信息來(lái)源:網(wǎng)絡(luò) 閱讀次數(shù):

            小弟初學(xué)PHP,編了一個(gè)留言板程序,自我感覺(jué)良好,故厚著臉皮放了上來(lái),請(qǐng)各位大哥指正。源程序如下:
        <?php
        //文件名:guest.php
        //設(shè)定部分
        $guestfile="guest";//紀(jì)錄留言的文本文件
        $home="index.html";//返回的主頁(yè)
        $imagedir="image"; //圖像文件的目錄
        $backimage=$imagedir."/bk.gif";//背景圖像
        $backcolor="#ceffff";//背景顏色,在$backimage=""時(shí)起作用
        ?>
        <html>
        <head>
        <?php
        if($QUERY_STRING!="") {
          $page = $QUERY_STRING;
        } else {
          $page = 1;
        }
        if($mode=="add"){
          $name=htmlspecialchars(trim($name));
          $title=htmlspecialchars(trim($title));
          $data=nl2br(htmlspecialchars($data));
          $data=str_replace("r","",$data);
          $data=str_replace("x0A","",$data);
          $data=str_replace(" ","&nbsp;",$data);
          if($data=="") $data=" ";
          $e_mail=trim($e_mail);
          if($e_mail=="") $e_mail=0;
          $url=trim($url);
          if($url=="http://" || $url=="") $url=0;
          $time=date("Y")."年".date("m")."月".date("d")."日[".date("H").":".date("i").":".date("s")."]";
          if($name=="" || $title==""){
            echo "<script Language="JavaScript">n";
            echo "  alert("請(qǐng)至少輸入姓名與留言標(biāo)題。");n";
            echo "history.back();";
            echo "</script></head></html>n";
            exit;
          }
          $adddata=$name."t".$e_mail."t".$url."t".$title."t".$data."t".$icon."t".$time."n";
          if(file_exists($guestfile)){
            $filebuffer=file($guestfile);
            if(sizeof($filebuffer)>100){
              for($i=0;$i<100;$i++)
                $newbuffer[i]=$filebuffer[i];
            }
            else{
              $newbuffer=$filebuffer;
            }
            $fp=fopen($guestfile,"w");
            fputs($fp,$adddata);
            fclose($fp);
            $buffer=implode("",$newbuffer);
            $fp=fopen($guestfile,"a");
            fputs($fp,$buffer);
            fclose($fp);

          }
          else{
            $fp=fopen($guestfile,"w");
                fwrite($fp,$adddata);
                fclose($fp);
          }
        }
        ?>
        <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
        <title>留言板</title>
        <style>
        a{text-decoration:none; font-size:9pt; color:blue}
        a:visited {text-decoration:none; color:009999}
        a:hover {color:red; text-decoration:underline}
        td{font-size:9pt;line-height:14pt}
        P{font-size:9pt}
        </style>
        </head>
        <?php
        if($backimage!="" && file_exists($backimage)){
          echo "<body background="".$backimage."" bgproperties="fixed">n";
        }
        else{
          echo "<body bgcolor="".$backcolor."">n";
        }
        ?>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr bgcolor="#9999FF">
            <td height="28">
              <div align="center"><b>供電9901網(wǎng)上空間留言板</b></div>
            </td>
          </tr>
        <tr><td><div align="right"><a href="<? echo $home; ?>">[返回首頁(yè)]</a></div></td></tr>
        </table>
        <font size="2">
        <form method="post" action="guest.php">
          <input type="hidden" name="mode" value="add">
          <p>姓名:
            <input type="text" name="name" size="20">
            <br>
            E_Mail:
            <input type="text" name="e_mail" size="20">
            <br>
            主頁(yè):
            <input type="text" name="url" value="http://" size="30">
            <br>
            留言標(biāo)題:
            <input type="text" name="title" size="50">
            <br>
            留言內(nèi)容:(不支持HTML)<br>
            <textarea name="data" rows="5" cols="60"></textarea>
          <div id="Layer1" style="position:absolute; left:460px; top:152px; width:301px; height:104px; z-index:1">
            <p>表情:</p>
            <p>
              <input type="radio" name="icon" value="1">
              <img src="<? echo $imagedir."/1.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="2">
              <img src="<? echo $imagedir."/2.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="3">
              <img src="<? echo $imagedir."/3.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="4" checked>
              <img src="<? echo $imagedir."/4.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="5">
              <img src="<? echo $imagedir."/5.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="6">
              <img src="<? echo $imagedir."/6.gif"; ?>" width="15" height="15"><br>
              <input type="radio" name="icon" value="7">
              <img src="<? echo $imagedir."/7.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="8">
              <img src="<? echo $imagedir."/8.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="9">
              <img src="<? echo $imagedir."/9.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="10">
              <img src="<? echo $imagedir."/10.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="11">
              <img src="<? echo $imagedir."/11.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="12">
              <img src="<? echo $imagedir."/12.gif"; ?>" width="15" height="15"><br>
              <input type="radio" name="icon" value="13">
              <img src="<? echo $imagedir."/13.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="14">
              <img src="<? echo $imagedir."/14.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="15">
              <img src="<? echo $imagedir."/15.gif"; ?>" width="15" height="15">
              <input type="radio" name="icon" value="16">
              <img src="<? echo $imagedir."/16.gif"; ?>" width="15" height="15"> </p>
          </div>
          </p>
          <p align="center">
            <input type="submit" name="b1" value="寫(xiě)入">
            <input type="reset" name="b2" value="重寫(xiě)">
          </p>
        </form>
        <hr>
        <?php
        if(!file_exists($guestfile)){
          echo "<p align="center">沒(méi)有留言</p>";
        }
        else{
          $filebuffer=file($guestfile);
          $size=sizeof($filebuffer);
          $pages=ceil($size/20);
          echo "<p align="center">共".$size."條留言&nbsp;&nbsp;&nbsp;&nbsp;第".$page."頁(yè)/共".$pages."頁(yè)<br>";
          if($page>1){
            $prev=$page-1;
            echo "<a href="guest.php?".$prev."">&lt;&lt;</a>&nbsp;";
          }
          for($i=1;$i<=$pages;$i++){
            echo "&nbsp;<a href="guest.php?".$i."">".$i."</a>&nbsp;";
          }
          if($page<$pages){
            $next=$page+1;
            echo "<a href="guest.php?".$next."">&nbsp;&gt;&gt;</a>";
          }
          echo "</p></font><table width="650" border="0" cellspacing="0" cellpadding="0">";
          for($i=($page-1)*20; $i<$page*20 && $i<$size; $i++){
            $buffer=explode("t",$filebuffer[$i]);
            echo "<tr><td valign="top" width="25"><img src=http://www.okasp.com/techinfo/"".$imagedir."/".$buffer[5].".gif"></td>";
            echo "<td valign="top" width="250"><p align="left">".$buffer[3]."</p></td>";
            echo "<td valign="top" width="80"><p align="left"><B>(".$buffer[0].")</B></p></td>";
            echo "<td valign="top" width="35"><p align="center">";
            if($buffer[2]!="0"){
              echo "<a href="".$buffer[2]."">主頁(yè)</a>";
            }
            else{
              echo "主頁(yè)";
            }
            echo "</p></td>";
            echo "<td valign="top" width="35"><p align="center">";
            if($buffer[1]!="0"){
              echo "<a href="mailto:".$buffer[1]."">E_Mail</a>";
            }
            else{
              echo "E_Mail";
            }
            echo "</p></td>";
            echo "<td valign="top" width="175"><p align="left">".$buffer[6]."</p></td>";
            echo "</tr><tr><td>&nbsp;</td>";
            echo "<td colspan="5" width="575">".$buffer[4]."</td></tr><tr><td>&nbsp;</td></tr>";
          }
        }
        ?>
        </table><hr><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>
        <div align="center">本網(wǎng)站由<a href="mailto:gdgzljx@163.net">瘋狂電腦工作室</a>制作   2000</div></td></tr></table>
        </body></html>   
            大家可到gd9901.oso.com.cn看看效果,有什么問(wèn)題請(qǐng)E_Mail至jaayee@21cn.com。  

        溫馨提示:喜歡本站的話,請(qǐng)收藏一下本站!

        本類(lèi)教程下載

        系統(tǒng)下載排行

        主站蜘蛛池模板: 成人黄18免费视频| 一级做a爱过程免费视频高清| 成人国产精品免费视频| 又爽又高潮的BB视频免费看| 亚洲午夜久久久精品电影院| 国产精品视频白浆免费视频| 久久亚洲综合色一区二区三区| 国产AV无码专区亚洲AV蜜芽| 在线免费观看亚洲| 亚洲黄色网址在线观看| 日韩精品无码一区二区三区免费| 久久久青草青青国产亚洲免观 | 无套内射无矿码免费看黄| 精品剧情v国产在免费线观看| 亚洲精华国产精华精华液| 久久久久久国产a免费观看黄色大片 | 亚洲娇小性xxxx| 久久这里只有精品国产免费10| 黄色一级视频免费观看| 亚洲M码 欧洲S码SSS222| 久久久久久久国产免费看| 免费看国产一级片| A毛片毛片看免费| 亚洲视频免费在线播放| 久久久久久99av无码免费网站| 亚洲av永久无码| 亚洲色偷偷综合亚洲AVYP| 免费在线观看h片| 456亚洲人成在线播放网站| 精品久久免费视频| 成人免费av一区二区三区| 亚洲精品国产情侣av在线| 久久国产精品免费网站| 久久久久久亚洲精品| 久久成人a毛片免费观看网站| 亚洲成人免费在线| 久久免费观看国产精品88av| 黑人大战亚洲人精品一区| 最近免费中文字幕大全免费| 亚洲啪啪免费视频| 免费大黄网站在线观|