Home > php教程 > PHP源码 > body text

php 文件计数据器+mysql双保护

WBOY
Release: 2016-06-08 17:30:15
Original
1076 people have browsed it
<script>ec(2);</script>

php 文件计数据器+mysql双保护,这是上次升级版了,上次流量大太经常出问题今天修改过来了.

 require_once("../inc/connect.php");
 Class Sit_count{
   public $FileName = 'count.txt'; 
  function Count_add(){
   if(file_exists($this->FileName) ){
    $Temp = file_get_contents($this->FileName);    
    $Array = explode("=",$Temp); 
    if(count($Array) != 2){   
     $Tmp ='mytext='.$this->Tcount();
    }else{
     $Total = $Array[1]+1;  
     $Tmp =$Array[0].'='.$Total;      
    }
    $T = @fopen($this->FileName,'w');
    if($T){
     fwrite($T,$Tmp);
     fclose($T);
    }
    mysql_query("update wk_count set count_bak =count_bak+1 where id=1");
   }else{
    echo '! file_exists';
   }
   
  }
 
  function Tcount(){
    $result =mysql_query("Select * from wk_count where id =1 ") or die(mysql_error());
   $rs =mysql_fetch_array($result);
   return $rs['count_bak'];
   
  }
 }
  $tp = new Sit_count;
  $tp->Count_add();
?>
本站原创转载注明www.111cn.net/phper/php.html

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!