PHP Base64_decode Decoding method

Source: Internet
Author: User

<?PHPHeader(' Content-type:text/html;charset=utf-8 ');functionEncode_file_contents ($filename) {    $type=Strtolower(substr(STRRCHR($filename, '. '), 1)); if(' php ' = =$type&&Is_file($filename) &&is_writable($filename)){//compressed code if PHP file is writable        $contents=file_get_contents($filename);//determine if the file has been encoded        $pos=Strpos($contents, ' Powered by Arzn qq:1314778 '); if(false===$pos||$pos&GT;100) {//Remove PHP file comments and whitespace, reduce file size            $contents=Php_strip_whitespace($filename); //Remove PHP header and tail markings            $headerPos=Strpos($contents, ' <?php '); $footerPos=Strrpos($contents, '?> '); $contents=substr($contents,$headerPos+5,$footerPos-$headerPos); $encode=Base64_encode(gzdeflate($contents));//Start Coding            $encode= ' <?php '. " \ n Eval (gzinflate (Base64_decode ("." ").$encode."‘".")));\ N\n?> "; return file_put_contents($filename,$encode); }    }    return false;}//calling Functions$filename= ' 1.php '; Encode_file_contents ($filename);Echo"OK, encryption done!" "?>

The above is the encryption code

Here is the decryption code

<?PHP$Code= ' Fill in the code to be decrypted here ';//base64 Encoding        $File= ' decoded.php ';//files saved after decoding        $Temp=Base64_decode($Code); $temp=gzinflate($Temp); $FP=fopen($File, "W"); fwrite($FP,$temp); fclose($FP); Echo"Decryption succeeds!" "; ?>

PHP Base64_decode Decoding method

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.