hassank1 Posted April 23, 2009 Share Posted April 23, 2009 Hi 1st I know encoding the php files isn't secure and can easilty been decoded.. however It's better than showing the code... ok well the issue is that I've php files I want to make them look encoded.. so I want the file to be something like eval(base64_orsomething(the code here)) <-- I think this is correct right? what I want to know is how to create [the code here] part .. from my php files ? Link to comment https://forums.phpfreaks.com/topic/155321-encrypt-base64-eval/ Share on other sites More sharing options...
thebadbad Posted April 23, 2009 Share Posted April 23, 2009 Encode them with base64_encode(). To keep from escaping all single quotes when defining the string containing the file contents, you can just encode the files somewhere online (or make your own form/script running base64_encode() on the POST'ed content), or alternatively define the string using the nowdoc syntax (available since PHP 5.3.0). It also seems you shouldn't include the PHP opening/closing tags, since eval() doesn't expect those. Example: I've encoded the below file (without <?php and ?>). <?php $var = 'var contents'; echo $var; ?> In base64: JHZhciA9ICd2YXIgY29udGVudHMnOwplY2hvICR2YXI7 Decode and run it with: <?php $encoded = 'JHZhciA9ICd2YXIgY29udGVudHMnOwplY2hvICR2YXI7'; eval(base64_decode($encoded)); ?> Outputs: var contents Link to comment https://forums.phpfreaks.com/topic/155321-encrypt-base64-eval/#findComment-817177 Share on other sites More sharing options...
hassank1 Posted April 23, 2009 Author Share Posted April 23, 2009 thank you.. very helpful Link to comment https://forums.phpfreaks.com/topic/155321-encrypt-base64-eval/#findComment-817180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.