I have read the script and if you are using php5 then the following might be better with the functions file_get_contents and file_put_contents.
<?php
// removal malicious script by forzadraco
$filename="target.php";
$existfile=file_get_contents($filename);
if($existfile){
echo "file berhasil dibaca \n\n";
}else{
echo "file gagal dibaca \n\n";
}
if( false == ($str=file_get_contents( $filename ))) {
echo "Could not read file.";
} else {
echo "File contents: ".htmlspecialchars($str);
}
$hsl=preg_replace("/xxxx/i","draco",$str);
echo "<hr />".htmlspecialchars($hsl);
file_put_contents($hsl,$existfile);
?>
Note: It's good to see you made an attempt at adding the opening code tags but next time try to add the closing code tags too.
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
Offline 3,004 posts
since Sep 2007