首页 新闻 会员 周边 捐助

跪求 PHP文件读写流的问题

0
悬赏园豆:10 [已关闭问题]

想请问一下这几个方法分别是做什么用的?主要是最后那个方法不懂?最好是标记注释。在下在这里谢过了。。虽然分数不多,但是没有办法了。只有这么多了.感激不尽....

<?php
class Account_Del
{
 ///Create File
 function Create_file($sFile)
 {
     if (!file_exists($sFile))
   { 
      $fp= fopen($sFile,"w+");
    system('chown apache '.$sFile);
      fclose($fp);
     }
 }

 ///Delete File
 function Delete_file($sFile) 
 {
  if(file_exists($sFile)) 
   unlink($sFile);
 } 
 
 function DelAcc()
 {  
  if(!file_exists("./ac/aclist.ini")) 
   exit;
  
  $fp =@fopen("./ac/aclist.ini","r");
  $temp="";
  while(!feof($fp))
  {
   $temp=$temp.fgets($fp);
  }
  
  $flag=false;
  
  $temp=str_replace("\r\n","",$temp);
  $Accounts=explode(",",$temp);
  
  $time  =  time();  
  $nowdate = date('Y-m-d',  $time);
  $Times1=explode("-",$nowdate);
  
  for($i=0;$i<count($Accounts);$i++)
  {   
   if($Accounts[$i]!="")
   {
    $first = substr($Accounts[$i],0,1);
    if (eregi("^[A-Za-z]{1}[A-Za-z]{0,2}$",$first))
    {
     $Accounts1=explode("&",$Accounts[$i]);
     if(strlen($Accounts1[1])>=8) //日期格式2008-04-08/2008-4-8/2008-04-8/2008-4-08 最少8位最长10位
     {
      $Times2=explode("-",$Accounts1[1]);    
      $n=(mktime(0,0,0,$Times1[1],$Times1[2],$Times1[0])-mktime(0,0,0,$Times2[1],$Times2[2],$Times2[0]))/(60*60*24);     
      if($n>=90)
      {    
       system('/usr/sbin/userdel -r '.$Accounts1[0], $return);
       if($return==0)
       {
        $flag=true;
        $Accounts[$i]="";
       }           
      }
     }//strlen
    }//eregi
   }
  }
  
  if($flag)
  {    
   $this->Delete_file("./ac/aclist.ini");
   $this->Create_file("./ac/aclist.ini");
   
   $temp="";
   $fp = @fopen("./ac/aclist.ini","a");
   for($i=0;$i<count($Accounts);$i++)
   {
    if($Accounts[$i]!="")
    {
     if(eregi("^[a-z]{1}[a-z]{0,2}$",substr($Accounts[$i],0,1)))
      $temp=$temp.$Accounts[$i].','; 
    } 
   }
   @fwrite($fp,$temp);   
   @fclose($fp);  
  } 
  
  exit;  
 }

}//end class

$AccDel =new Account_Del;
$AccDel->DelAcc();
?>

=======下面是aclist.ini文件的信息=分别是 用户名 创建时间 终止时间====

root&&,bin&&,daemon&&,adm&&,lp&&,sync&&,shutdown&&,halt&&,mail&&,news&&,uucp&&,operator&&,games&&,gopher&&,ftp&&,nobody&&,ntp&&,rpc&&,vcsa&&,nscd&&,sshd&&,rpm&&,mailnull&&,smmsp&&,rpcuser&&,nfsnobody&&,pcap&&,xfs&&,wnn&&,named&&,gdm&&,desktop&&,postgres&&,apache&&,postfix&&,squid&&,webalizer&&,oishare&&,jasonma&&,sente&&,mysql&&,oi&&,gaga&&,fisherprice&&,fisherprice327&&,hasbro&&,mattel&&,mattel_la&&,softshare&&,sonix&&,MGA&&,temp&&,VisualStudio&&,stock&&,sat&&,leapfrog&&,cdttest&&,winenterprise&&,PIL&&,vtech&&,smtpu&&,solforcarmen&&,Mattel&&,EI&&,Tomy&&,SWT&&,mike&&,mattel_hk&&,Takara&&,konami&&,cranium&&,wizardtronics&&,reddot&&,hasbro_fran&&,sonix-cdt&&,fp_kd&&,mgae&&,temp_cdt&&,usr&&,kdi&&,kidsii&&,TomyUK&&,toytec&&,DES&&,mt&&,warehouse&&,acct_hk&&,idt&&,huaqi&&,omnivision&&,mac&&,it&&,micomtech&&,backpacktoys&&,IDT&&,pacific_hk&&,mttest&&,mga&&,onyxx&&,test&&,test1&&,mattel_tmp&&,wiltec&&,sunvigor&&,spinmaster&&,mis0810&2009-08-26&2035-12-31,mis0811&2009-08-11&2009-08-25,philips&2009-08-11&2009-08-25,vt_temp&2009-08-12&2009-08-26,sonosys&2009-08-13&2009-08-27,R3916&2009-08-13&2009-08-27,www888&2009-08-14&2009-08-28,simtec&2009-08-17&2009-08-31,puppy&2009-08-18&2009-09-01&idtidt&2009-08-20&2009-09-03,R9100&2009-08-20&2009-09-03,vt110605&2009-08-21&2009-09-04,mhg&2009-08-26&2009-09-09,Voice&2009-08-27&2009-09-10,midi&2009-08-27&2009-09-10,SNC712&2009-09-01&2009-09-15,OI2009&2009-09-01&2009-09-15,mis0901&2009-09-01&2009-09-15,davidw&2009-09-03&2009-09-17,Herald&2009-09-04&2009-09-18,Escope&2009-09-08&2009-09-22,wilsonli&2009-09-09&2009-09-23,Book&2009-09-09&2009-09-24,caddie&2009-09-10&2009-09-24,V117000&2009-09-10&2009-09-24,sound&2009-09-11&2009-09-25,ericfung&2009-09-14&2009-09-28,vtech03&2009-09-15&2009-09-29,talent&2009-09-16&2009-09-30,idthk&2009-09-16&2009-09-30,vt110604&2009-09-16&2009-09-30,ching1&2009-09-17&2009-10-01,T4272&2009-09-17&2009-10-01,WUTZSD03&2009-09-18&2009-10-02,SNC712c&2009-09-18&2009-10-02,dm27132&2009-09-21&2009-10-05,benjalin&2009-09-22&2009-10-06,mis0923&2009-09-23&2009-10-07,W200909&2009-09-23&2009-10-07,t2rd0925&2009-09-25&2009-10-09,vthf0925&2009-09-25&2009-10-09,mis0928&2009-09-28&2009-10-12,voice09&2009-09-28&2009-10-12,caddie1&2009-09-28&2009-10-12,vt110622&2009-09-29&2009-10-13,RSV&2009-09-30&2009-10-14,vt110623&2009-09-30&2009-10-14,WUTZ_V01&2009-09-30&2009-10-14,LC99596&2009-10-07&2009-10-21,TMC&2009-10-07&2009-10-21,FB02&2009-10-07&2009-10-21,ids712&2009-10-08&2009-10-22,dm110622&2009-10-13&2009-10-27,rc2ef&2009-10-14&2009-10-28,mis0914&2009-10-14&2009-10-28,escope&2009-10-15&2009-10-29,dm110623&2009-10-15&2009-10-29,snx1015&2009-10-15&2009-10-29,tt1016&2009-10-16&2009-10-30,balloon&2009-10-16&2009-10-30,keita&2009-10-16&2009-10-30,t1403712&2009-10-16&2009-10-30,honeybee&2009-10-17&2009-10-31,caddie2&2009-10-22&2009-11-05,Chomp&2009-10-27&2009-11-10,OTP&2009-10-27&2009-11-10,spin1028&2009-10-28&2009-11-11,mis1028&2009-10-28&2009-11-11,CY800&2009-10-29&2009-11-12,rav&2009-10-29&2009-11-12,vt101923&2009-10-29&2009-11-12,radica&2009-10-30&2009-11-13,nerul26f&2009-11-04&2009-11-18,caddie3&2009-11-04&2009-11-18,rc2eric&2009-11-05&2009-11-19,

问题补充: 最后这个方法是: function DelAcc()
zhangpeng1008的主页 zhangpeng1008 | 菜鸟二级 | 园豆:283
提问于:2009-11-05 16:48
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册