欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于文本的訪客簽到簿

 更新時間:2006年10月09日 00:00:00   作者:  
一個很偶然的機會,在網(wǎng)上看到了有人用PHP+MYSQL作了一個訪客簽到簿, 當(dāng)時覺得很有用處所以自己也很 想搞一個。但是用MYSQL覺得有點在材小用,所以就搞了一個基于文本的訪客簽到簿。其功能與我在網(wǎng)上看 到的用MYSQL作的差不多,在這里我將其源碼公布,希望它對放大網(wǎng)友學(xué)習(xí)PHP有所幫助。限于本人的水平, 其中定有BUG,還希望朋友發(fā)現(xiàn)了不要忘告訴我一下。本簽到簿由要兩個文件組成:一個是存放簽到信息的sign.txt文件, 該文件可以由NOTEPAD來創(chuàng)建;第二個 是處理信息的sign.php文件。在斑竹園的主頁<http://bamboo.oso.com.cn>有它的演示,歡迎去看看。下面
就是sign.php的源代碼:
sign.php
if(isset($name)&&isset($msg)){
   $name=ltrim($name);
   $t=date(y年m月d日);
   $dat="[".$t."]";
   $msg=ltrim($msg);
   $name=trim($name);
   $msg=trim($msg);
   $pristr=$name."&nbsp&nbsp".$dat."&nbsp".$msg."\n";
   $f=fopen("sign.txt","a");
   fwrite($f,$pristr);
   fclose($f);
   }
   $file=file("sign.txt");
    if(!isset($pagenum)){
      $pagenum=1;
    }
    $lesssign=0;
    $num=count($file);
    $dispnumed=6*($pagenum-1);
    $dispnumbeg=$num-$dispnumed;
    $artnumeof1=6*$pagenum;
    $isdispnum=$num-$artnumeof1;
     if($isdispnum<=0){
      $dispnumeof=1;
      $lesssign=1;
    }
    else{
      $dispnumeof=$isdispnum+1;
    }
    $sign=0;
    $pagec=0;
     for($icount=0;($icount<$num)&&($sign==0);$icount+=6){
      for($i=0;$i<=6;$i++){
       if(($icount*6+$i)==$num){
           $sign=1;
         }
       }
       $pagec++;
     }
    $pagecount=$pagec;
    echo"<table width=100% cellspacing=3>";
    $fuhao="◇  ";
    $color=e9eae9;
    $iscolor=0;
    $lessnum=5;
    echo"<tr><td bgcolor=00ff00 align=center>";
    echo"斑竹園簽到簿";
    echo"</td></tr>";
    for($i=$dispnumbeg;$i>=$dispnumeof;$i--){
       $linknum=$num-$i;
       $lessnum--;
       $stringmsg1=$file[($i-1)];
       $stringmsg2=strrev($stringmsg1);
       $stringmsg3=strstr($stringmsg2,"psbn");
       $stringmsg=strrev($stringmsg3);
       $stringlink=strstr($file[($i-1)],"http");
       $dispvar=$fuhao.$stringmsg;
       echo"<tr><td bgcolor=$color>";
       echo$dispvar;
       echo "<img src=gif/home3.gif>";
       echo"<a href=$stringlink>";
       echo$stringlink;
       echo"</a>";
       echo"</td></tr>";
       if($iscolor==0){
         $color=ffffff;
         $iscolor=1;
       }
       else{
         $color=e9eae9;
         $iscolor=0;
       }
    }
    if($lesssign==1){
         for($iless=$lessnum;$iless>0;$iless--){
       echo"<tr bgcolor=$color><td>";
       echo $fuhao."<br>\n";
       echo"</td></tr>";
          if($iscolor==0){
         $color=ffffff;
         $iscolor=1;
       }
       else{
         $color=e9eae9;
         $iscolor=0;
       }
       }
    }
    echo"<tr>";
    echo"<form action=index.php method=post>";
    echo"<td>";
    echo"稱呼:";
    echo"<input name=name size=10 maxlength=20>";
    echo"地址:";
    echo"<input name=msg size=20 maxlength=60 value=http://>";
    echo"<input type=submit name=submit value=簽到>";
    echo"</td>";
    echo"</form>";
    echo"</tr>";

    echo"</table>";
   ?> 

相關(guān)文章

  • vBulletin HACK----顯示話題大小和打開新窗口于論壇索引頁

    vBulletin HACK----顯示話題大小和打開新窗口于論壇索引頁

    vBulletin HACK----顯示話題大小和打開新窗口于論壇索引頁...
    2006-10-10
  • php empty函數(shù)判斷mysql表單是否為空

    php empty函數(shù)判斷mysql表單是否為空

    判斷數(shù)據(jù)庫字段是否為空,這個php沒有直接的功能,但是我們可以利用mysql_fetch_array()函數(shù)的返回
    2010-04-04
  • php date()日期時間函數(shù)詳解

    php date()日期時間函數(shù)詳解

    php中date()日期時間函數(shù)詳解,需要的朋友可以參考下。
    2010-05-05
  • PHP中call_user_func_array()函數(shù)的用法演示

    PHP中call_user_func_array()函數(shù)的用法演示

    今天,看了一段代碼,里面用到了很多call_user_func_array()函數(shù),一開始,也是非常的迷糊,后來經(jīng)過查手冊發(fā)現(xiàn),call_user_func_array()函數(shù)還是很好用的,所以把PHP中call_user_func_array()函數(shù)用法用簡單的代碼示例來說明一下
    2012-02-02
  • 關(guān)于PHP中的Class的幾點個人看法

    關(guān)于PHP中的Class的幾點個人看法

    關(guān)于PHP中的Class的幾點個人看法...
    2006-10-10
  • PHP4引用文件語句的對比

    PHP4引用文件語句的對比

    PHP4引用文件語句的對比...
    2006-10-10
  • 第七章 php自定義函數(shù)實現(xiàn)代碼

    第七章 php自定義函數(shù)實現(xiàn)代碼

    使用自定義函數(shù)的目的:避免大量重復(fù)代碼的出現(xiàn)。
    2011-12-12
  • 一個典型的PHP分頁實例代碼分享

    一個典型的PHP分頁實例代碼分享

    一個典型的PHP分頁實例代碼分享,學(xué)習(xí)php的朋友肯定用得到,主要是了解思路。
    2011-07-07
  • 最新評論