How to clear webpage viruses. How to clear the webpage virus haha. this upgrade has been made. all previously stored data is now stored externally as txt files. this advantage is not easy to modify ,? Phpexit (); Classclear_virus {method of clearing web page viruses haha, this upgrade, previously stored data is now all stored in the external txt file, this advantage is not easy to modify oh,
Exit ();
Class clear_virus {
// Public $ content;
Public $ infectFile named 'virus.txt '; // virus file list file
Public $ savefile = "save.txt"; // list of virus files
Public $ timep specify 'time.txt '; // The time when some records are cleared.
Public $ checkFile = 'index. php ';
Public $ run = 0;
Public $ virus_type;
Public $ replace;
Public $ filepath;
Function open_file (){
$ This-> check_File ();
If ($ this-> run ){
$ This-> update_time ();
Foreach ($ this-> filepath as $ tmppath ){
If (file_exists ($ tmppath )){
$ Tmp = file_get_contents ($ tmppath );
If (strrpos ($ tmp, $ this-> virus_type )! = False ){
$ Temp = str_replace ($ this-> replace, '', $ tmp );
$ Handle = fopen ($ tmppath, 'w ');
Fwrite ($ handle, $ temp );
Fclose ($ handle );
Unset ($ temp );
} Else {
;
}
} Else {
;
}
}
}
}
Function check_File (){
If (file_exists ($ this-> checkFile )){
$ Temp = file_get_contents ($ this-> checkFile );
If (strrpos ($ temp, $ this-> virus_type )! = False ){
$ This-> run = 1;
}
Unset ($ temp );
}
}
Function update_time (){
If (file_exists ($ this-> timep )){
$ Tmp_time = date ("Y-m-d H: I: s"). chr (13). '| ';
$ Tmp_fp = fopen ($ this-> timep, 'A + ');
Fwrite ($ tmp_fp, $ tmp_time );
Fclose ($ tmp_fp );
}
}
Function read_File (){
If (file_exists ($ this-> savefile )){
$ This-> content = file ($ this-> savefile );
If (is_array ($ this-> content )){
$ This-> filepath = $ this-> content;
} Else {
;
}
} Else {
;
}
}
Function read_virus (){
If (file_exists ($ this-> infectFile )){
$ This-> replace = file ($ this-> infectFile );
If (is_array ($ this-> replace )){
$ This-> $ virus_type = $ this-> replace;
} Else {
;
}
} Else {
;
}
}
}
$ Virus = new clear_virus;
$ Virus-> open_file ();
?>
Please post your remarks. please refer to the original article on this site. www.111cn.cn/phper/php.html
Success ,? Php exit (); Class clear_virus {//...