Php implements source code encryption. php source code encryption _ PHP Tutorial

Source: Internet
Author: User
Php implements source code encryption, and php source code encryption. Php implements source code encryption. this example describes how php implements source code encryption. Share it with you for your reference. The specific implementation method is as follows: phpfun php implements source code encryption, and php source code encryption

This example describes how to implement source code encryption in php. Share it with you for your reference. The specific implementation method is as follows:

<? Php function RandAbc ($ length = "") {// returns a random string $ str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; return str_shuffle ($ str);} $ filepath = 'index. php '; $ path_parts = pathinfo ($ filepath); $ filename = $ path_parts ["basename"]; $ T_k1 = RandAbc (); // random key 1 $ T_k2 = RandAbc (); // random key 2 $ vstr = file_get_contents ($ filename ); // the file to be encrypted $ v1 = base64_encode ($ vstr); $ c = strtr ($ v1, $ T_k1, $ T_k2); // replace the corresponding character with the key. $ C = $ T_k1. $ T_k2. $ c; $ q1 = "O00O0O"; $ q2 = "O0O000"; $ q3 = "O0OO00"; $ q4 = "OO0O00"; $ q5 = "OO0000 "; $ q6 = "O00OO0"; $ s = '$ '. $ q6. '= urldecode ("% 6E1% 7A % 62% 2F % 6D % 615% 5C % 76% 740% 6928% 2D % 70% 78% 75% 71% 2A6% 6C % 79% 6B % 72% 5F % 65% 68% 63% 73% 77% 6F4% 2B % 6637% 6A "); $ '. $ q1. '= $ '. $ q6. '{3 }. $ '. $ q6. '{6 }. $ '. $ q6. '{33 }. $ '. $ q6. '{30}; $ '. $ q3. '= $ '. $ q6. '{33 }. $ '. $ q6. '{10 }. $ '. $ q6. '{24 }. $ '. $ q6. '{10 }. $ '. $ q6. '{24}; $ '. $ q4. '= $ '. $ q3. '{0 }. $ '. $ q6. '{1 8 }. $ '. $ q6. '{3 }. $ '. $ q3. '{0 }. $ '. $ q3. '{1 }. $ '. $ q6. '{24}; $ '. $ q5. '= $ '. $ q6. '{7 }. $ '. $ q6. '{13}; $ '. $ q1 .'. = $ '. $ q6. '{22 }. $ '. $ q6. '{36 }. $ '. $ q6. '{29 }. $ '. $ q6. '{26 }. $ '. $ q6. '{30 }. $ '. $ q6. '{32 }. $ '. $ q6. '{35 }. $ '. $ q6. '{26 }. $ '. $ q6. '{30}; eval ($ '. $ q1 .'("'. base64_encode ('$ '. $ q2. '= "'. $ c. '"; eval (\'?> \'. $ '. $ Q1. '($ '. $ q3. '($ '. $ q4. '($ '. $ q2. ', $ '. $ q5. '* 2), $ '. $ q4. '($ '. $ q2. ', $ '. $ q5. ', $ '. $ q5. '), $ '. $ q4. '($ '. $ q2. ', 0, $ '. $ q5 .'))));'). '");'; $ s = '<? '. $ S.'?> '; Echo $ s; // Generate the encrypted php file! Is_dir ('create/') & mkdir ('create/'); $ fpp1 = fopen ('create /'. $ filename, 'w'); fwrite ($ fpp1, $ s) or die ('file writing error'); echo 'encrypted successfully! ';

I hope this article will help you with php programming.

Examples in this article describes how php implements source code encryption. Share it with you for your reference. The specific implementation method is as follows: php fun...

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.