Spring Brother Technology blog to talk about PHP source encryption that something

Source: Internet
Author: User
Tags ioncube

Today Spring Brother Technology blog to everyone about the source of encryption of those things. Encryption is a hindrance to progress, ASP. NET is because they are compiled post, resulting in a few excellent source code.

PHP Source comparison is commonly used Zend Company's Zendguard and Ioncube Company's Ioncube PHP Encode. Neither of these encryption can be run independently. The Zendoptimizer and ioncube PHP accelerator PHP engine will be able to decode the operation normally. If you do not want to encrypt under a third-party engine, you can use the following method: see Code

function Encode_file_contents ($filename) {

$type =strtolower (substr (STRRCHR ($filename, '. '), 1));

if (' php ' = = $type && is_file ($filename) && is_writable ($filename)) {//If it is a PHP file and can be written with compression encoding

$contents = file_get_contents ($filename); Determine if the file has been encoded

$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;

}

Run the encrypted code after eval (gzinflate (Base64_decode (' encrypted string '));

As follows

650) this.width=650; "src=" Http://p3.pstatp.com/large/14210006b665979b7bf7 "alt=" PHP source encryption that Thing "width=" 640 "height=" 483 "border=" 0 "vspace=" 0 "title=" PHP source encryption that something "style=" border:0px;vertical-align:middle;margin:10px auto;height:483px ; width:640px; "/>

This is the source code.

650) this.width=650; "src=" http://p3.pstatp.com/large/149e00011ad33ae8f209 "alt=" PHP source encryption that point "style=" border:0px; vertical-align:middle;margin:10px auto;height:auto; "/>

The post-encryption prototype is like this.

650) this.width=650; "src=" http://p3.pstatp.com/large/14210006b664da6ad78c "alt=" PHP source encryption that point "style=" border:0px; vertical-align:middle;margin:10px auto;height:auto; "/>

It's complicated after that.

650) this.width=650; "src=" http://p3.pstatp.com/large/141d0004e68f97cb7e9b "alt=" PHP source encryption that point "style=" border:0px; vertical-align:middle;margin:10px auto;height:auto; "/>

After that, it's like this.

Key points function: eval (), Base64_encode (), Base64_decode (), Gzinflate (), Gzdeflate ()

It can also be used in combination with other encoding and decoding functions.


The source of this article:http://www.cgtblog.com/jishu/1004.html, reprint please indicate the source (spring Brother qq:2931393342: Wocgtblog)


This article is from the "Spring Brother Team Technical Blog" blog, please be sure to keep this source http://cyeagle.blog.51cto.com/3168672/1931574

Spring Brother Technology blog to talk about PHP source encryption that something

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.