Begging for PHP file read/write stream issues

Source: Internet
Author: User
What are the usage of these methods? What is the last method? It is better to mark comments. Thank you later .. Although the score is not much, there is no way. There's only so much. Thank you ....? PhpclassAccount_Del {CreateFilefunctionCreate_file ($ sFile) {if (! File_exis

What are the usage of these methods? What is the last method? It is better to mark comments. Thank you later .. Although the score is not much, there is no way. There's only so much. Thank you ....? Php class Account_Del {// Create File function Create_file ($ sFile) {if (! File_exis

What are the usage of these methods? What is the last method? It is better to mark comments. Thank you later .. Although the score is not much, there is no way. It's only so much. I'm grateful ....

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 {
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) // Date Format: 2008-04-08/2008-4-8/2008-04-8/2008-4-08; minimum 8-bit; maximum 10-bit
{
$ 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", "");
For ($ I = 0; $ I {
If ($ Accounts [$ I]! = "")
{
If (eregi ("^ [a-z] {1} [a-z] {} $", substr ($ Accounts [$ I )))
$ Temp = $ temp. $ Accounts [$ I]. ',';
}
}
@ Fwrite ($ fp, $ temp );
@ Fclose ($ fp );
}

Exit;
}

} // End class

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

======= The information of the aclist. ini file = the end time of the User Name Creation Time ===

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 &&, &, 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 &, wizardtrow.& &, 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, Jun & 2009-08-21 & Jun, mhg & 2009-08-26 & 2009-09-09, Voice & 2009-08-27 & 2009-09-10, midi &, OI2009 &, mis0901 &, David W &, Herald,, wilsonli, Book, caddie, V117000, sound, 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 &, benjalin, mis0923,, t2rd0925, vt110622 & 2009-10-13, CLR & 2009-09-30 & 2009-10-14, vt110623 & 2009-09-30 & 2009-10-14, & 2009-09-30 & 2009-10-14, LC99596 & 2009-10-07 & 2009-10-21, TMC & 2009-10-07 & 2009-10-21, FB02 & 2009-10-01007 & 2009-10-21, Jun & 2009-10-010-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, Jun & 2009-10-15 & 2009-10-29, example & 2009-10-15 & 2009-10-29, example & 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, examples & 2009-10-17 & 2009-10-31, caddie2 & 2009-10-22 & 2009-11-011-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, Clerk & 2009-10-29 & 2009-11-12, radica & 2009-10-30 & 2009-11-13, nerul26f & 2009-11-4 & 2009-11-18, caddie3 & 2009-11-4 & 2009-11-18, rc2eric & 2009-11-5 & 2009-11-19,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.