Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 PHP Code: Base 64 Decode Jump to:  
Category: >> PHP Code >> Base 64 Decode Bookmark and Share

<< lastnext >>

Snippet Name: Base 64 Decode

Description: I recently ran across a freeware web application written in PHP that utilized the following method to encrypt its source code. You can decode the encoded script with this PHP snippet.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: February 28th, 2009

// sample is encoded like this:
// eval(gzinflate(base64_decode('encoded text'))); 
ECHO "\nDECODE nested eval(gzinflate()) by DEBO Jurgen <[email protected]>\n\n";
ECHO "1. Reading coded.txt\n";
$fp1 = FOPEN ("coded.txt", "r");
$contents = FREAD ($fp1, FILESIZE ("coded.txt"));
ECHO "2. Decoding\n";
WHILE (PREG_MATCH("/eval\(gzinflate/",$contents)) {
$contents=PREG_REPLACE("/< \?|\?>/", "", $contents);
EVAL(PREG_REPLACE("/eval/", "\$contents=", $contents));
ECHO "3. Writing decoded.txt\n";
$fp2 = FOPEN("decoded.txt","w");
FWRITE($fp2, TRIM($contents));
1.) Save the code you wish to decode in coded.txt
2.) Save the above PHP snippet in file like decrypt.php
3.) Create an empty text file called decoded.txt and it CHMOD it to 0666.
4.) Run decrypt.php and open up decoded.txt to view the source code.

Oracle Magazine
and Oracle White Papers

SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 24 users online    © 2009 psoug.org

Forgot your password?