<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      一個自定義位數的多用戶計數器

      [摘要]此計數器能夠自定義任意位數,而且在免費提供的時候能夠顯示一個簡單的廣告。運行的時候需要在計數器目錄下創建一個nobody帳戶有權改寫的目錄datas.實際運行的例子在http://www.hnpts...
      此計數器能夠自定義任意位數,而且在免費提供的時候能夠顯示一個簡單的廣告。
      運行的時候需要在計數器目錄下創建一個nobody帳戶有權改寫的目錄datas.
      實際運行的例子在
      http://www.hnpts.ha.cn/freecount.htm
      <?
      Header("Content-type: image/png");
      if ($user=="") $user="test";
      $fn="datas/".$user.".txt";
      if ($bit=="") $bit=8;   //取默認值
      if (is_readable($fn)) {$f=fopen($fn,"r");
                             $c=fgets($f,255);fclose($f);} //讀出原來的計數值
          else $c="0"; //新用戶
      $l=strlen($c);  //計算實際值長度
      $cnt="";
      for ($i=0;$i<$bit-$l;$i++) $cnt.="0";//前面加“0”補足指定的位數
      $cnt.=$c;$c1=intval($c);$c1++;
      $f=fopen($fn,"w");fputs($f,$c1);fclose($f); //寫回
        $font=20;
      if (($c1%10==9)&&($user!="test")) {$cnt="www.hnpts.ha.cn";$font=16;}
      //達到條件就顯示廣告
      $s=ImageTTFBBox($font,0,"times.ttf", $cnt);
      $x=abs($s[4])+8;$y=abs($s[5])+7;
      $im = imagecreate($x,$y);
      $black = ImageColorAllocate($im, 0,0,0);
      $white = ImageColorAllocate($im, 255,255,255);
      if ($font==20) {$green = ImageColorAllocate($im, 0,255,0);
                      imagerectangle($im,1,1,$x-2,$y-2,$white);}
      else $green = ImageColorAllocate($im, 255,255,255);
      ImageTTFText($im,$font,0, 3,$y-5, $green, "times.ttf", $cnt);
      ImagePng($im);
      ImageDestroy($im);

      ?>






      日韩精品一区二区三区高清