paddy_fields Posted February 19, 2014 Share Posted February 19, 2014 (edited) I've tried Googling for advice on this but I keep seeing conflicting ideas... time to ask the experts! I'm creating a CMS system. This is nearly completed and has all of the core functionality that my main client base will require. However over time I would like to develop and offer additional plugins/bolt-on features, (that can be purchased additionally from the basic system) Could a 'plugin system' be as simple as just making a seperate folder called 'plugins', and having each script in there seperately as 'plugin1.php', 'plugin2.php' etc I could then store in the database details of whether the user owns the plugin, and fetch this to a variable... if($plugin2==true){ include('plugin/plugin2.php') } Is this really a good way of doing this? Any advice would be great. Edited February 19, 2014 by paddyfields Quote Link to comment Share on other sites More sharing options...
WebStyles Posted February 20, 2014 Share Posted February 20, 2014 I see no problem with that. It's a design decision, and simple approaches are almost always better than complicated ones. If you're confident that using that approach does not allow the user to bypass it in any way, then it's as good as any other solution. Maybe even better because it's nice and simple. It really depends on how everything else is built and if a simple include is enough to properly implement the extra modules. Quote Link to comment Share on other sites More sharing options...
paddy_fields Posted February 21, 2014 Author Share Posted February 21, 2014 (edited) Thanks, thats good to know. I'm going to design the plugins so that they can be implemented without any fuss. I've been reading up on the security side and the method below seems good enough to stop people accessing the plugins directly. //at the top of the plugin <?php if (!defined('PLUGIN')) exit; ?> //before the plugin include <?php define('PLUGIN', true); ?> Then an conditional statement such as my previous post should keep anyone from messing with the script. Of course I need to be careful with the form/script that updates the database with new plugin purchases. I'm thinking a moat and drawbridge should do it! Edited February 21, 2014 by paddyfields Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.