Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty template encryption using ionCube 8.3

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Vishal_2220
Smarty Rookie


Joined: 21 Aug 2014
Posts: 5

PostPosted: Thu Aug 21, 2014 1:17 pm    Post subject: Smarty template encryption using ionCube 8.3 Reply with quote

I have used ionCube(ver. 8.3) to encrypt .tpl,.php files including smarty library files, I am able to encode them successfully with all Obfuscation options checked and able to generate Key file also. But when I try to open my index.php page it gives me following error ...

Fatal error: Uncaught exception 'LogicException' with message 'Function 'smartyAutoload' not found (function 'smartyAutoload' not found or invalid function name)' in C:\cc\htdocs\App_Encode\Smarty\libs\Smarty.class.php:0 Stack trace: #0 C:\cc\htdocs\App_Encode\Smarty\libs\Smarty.class.php(0): obfuscated #1 C:\cc\htdocs\App_Encode\index_standard_creation.php(0): unknown() #2 {main} thrown in C:\cc\htdocs\App_Encode\Smarty\libs\Smarty.class.php on line 0

The patch which is provided by ionCube is for Smarty 2.* ..since I am using Smarty 3.1.18 version and PHP Ver. 5.5...

I am not able to understand where problem lies as I am new to PHP programming. I have tried following patch in getContent() function in \libs\plugins\smarty_internal_resource_file.php ..But it's no use Sad

public function getContent(Smarty_Template_Source $source)
{
if ($source->timestamp) {
if (function_exists('ioncube_read_file')) {
return ioncube_read_file($source->filepath);
} else {
return file_get_contents($source->filepath);
}
}
if ($source instanceof Smarty_Config_Source) {
throw new SmartyException("Unable to read config {$source->type} '{$source->name}'");
}
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}


Please help me out!!
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Aug 21, 2014 7:08 pm    Post subject: Reply with quote

There should be no reason to encode the core Smarty library files, and that is also against the license agreement. Smarty is open source, why try to encode it? IMHO encoding is a terrible approach to security anyways. Protect your code with licensing, not encoding. Encoding is a false sense of security and completely wreaks havoc with installations. I will just tell you now, you will eventually do away with encoding after you wrestle with it long enough.
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Aug 21, 2014 7:17 pm    Post subject: Reply with quote

I also found on the ionCube forums their answer:

Code:
The error is expected behaviour because the Encoder has renamed smartyAutoload and you are specifying its original name.

Create an obfuscation exclusion list and exclude smartyAutoload from being obfuscated.


I would advise to exclude ALL of the Smarty core library files. You can still encode your custom plugin files and whatnot if you like. Keep them separate from the distribution folder so upgrades are manageable.
Back to top
View user's profile Send private message Visit poster's website
Vishal_2220
Smarty Rookie


Joined: 21 Aug 2014
Posts: 5

PostPosted: Fri Aug 22, 2014 7:34 am    Post subject: Reply with quote

Thanks for replying..
That ionCube support reply in their forum was for my question only Razz

Now I have excluded Smarty library from encoding and encrypting only .tpl., .php files
But getting following error..

Fatal error: in C:\cc\htdocs\App_Encode\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 819

I have gone through following forum post but still can't able to fix the problem. I am using PHP 5.5 version.

http://www.smarty.net/forums/viewtopic.php?p=75560
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Aug 22, 2014 1:53 pm    Post subject: Reply with quote

What is the full error?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP