How to Expire Template Demos

Posted on April 2, 2007
Filed Under Design, Template Design Kit | 2 Comments


Expiring template demonstrations and protecting your work.

If you’ve ever wanted to allow a potential customer the ability to demo your template or themes while still protecting your rights then this little snippet may be the answer.

The idea behind the code is to simply provide a potential buyer or client a theme they can test run on their domain and expire the template after a period of time. Having worked for large template houses in the past, I’ve seen all too frequently where people have ripped off designs by simply looking at the web page source code and figuring out the rest from there. The temptation is to use tactics many times lengthy to protect your work often resulting in a slow loading site.

Now I use to publish live demos on my domains much like the template houses do and one of my favorite techniques that works great is to simply encrypt the template with a tool called HTML Guardian which works beautifully for such things. You can post a live working example of the theme or template and the code is completely hidden from prying eyes until they purchase the design.

The only major setback in using a tool like HTML Guardian is that search engines will not index a page that uses it because the search engines cant see the code and code they cant see they don’t index regardless of what people tell you about content surfing and all the other alleged search engine techniques. The plain fact is that search engines will not index your site if they cant see the code.

So, using a $50 program I purchased about two years ago called CodeLock I’ve been encrypting only a small portion of my designs or in some instances several portions to protect my work and still allow search engines to work their magic. If your templates are worth anything they are certainly worth the trivial $55 to purchase CodeLock to protect your investment.

Step One

First we need to get the current server time to create time lock period and to do that you simply add the following code to a file called "gettime.php" as I’ve done IN THIS EXAMPLE.

<?php
echo time();
?>

Step Two

Next we need to calculate the expire time to add to the script in Step Three. To do this we use a formula to calculate the time we simply multiply days X hours X minutes X seconds so it would be 7x24x60x60=604800 for a 7 day trial. Try this calculator below, I’ve set up two fields for you, one is if you want to expire by number of days and the other is if you are seeking to expire by a specified number of weeks. Just enter the number and press the tab key, it should automatically give you the time.

  Enter Period   $end_trial
Expire in Days  
Expire in Weeks  


Step Three

Next we need to add the server time from the “gettime.php” to the script below and also add the $end_trial time as well. To do so add the server time to $start_trial and the end period (7 days in our example) to $end_trial = $start_trial + 604800

<?php

$start_trial = 1157044256; //this is the time from gettime.php
$end_trial = $start_trial + 604800; //this is the expire time from the calculator above
$current_time = time();
$remaining_trial = $end_trial – $current_time;
if ($current_time > $end_trial) {
//modify the text below to give the message you want upon expiration.
die(‘Your trial has expired. Please contact jared – at – thebrokersedge.com for unlock procedure <a href="http://www.thebrokersedge.com" target="_blank">Contact The Brokers Edge</a> to purchase a license for the UltimateIDX for only $299.95 to continue‘);
}
?>

Step Four

Now simply paste the above code from Step Three with your time edits into the header of your HTML or PHP document or any dependent file prior to encryption. I’ve placed this file in many things from dynamic JPG files to the core class files in php. If your server can parse a file with the PHP engine then you can put this code just about anywhere you wish to activate the expiration code. Upon doing so you simply visit http://www.jaredritchey.com/codelock/ and encrypt your code.

Using the encrypter is quite simple as you will notice once you select the third button on the left titled “Segment” and then make your code selection for either HTML or PHP. Paste in your code including the time lock snippet you created above into the encrypter window and select “Encrypt”. Thats it! Your done!

By example if you had created template for vBulletin or Joomla for instance you could simply take all of the header code, paste in your time lock, and then encrypt that code to be used in your demo. Once you paste in the encrypted code back into your original document (saving an original backup of course) your template is now time locked. Naturally you can encrypt larger portions of your code that do not want prying eyes to see but by doing so you end up with a page that search engines may not like. The key is to be clever in what you encrypt so the removal of the encrypted time lock would be difficult, otherwise a clever thief could simply jack your design and replace the encrypted sections with the logical replacements necessary. I’m a big fan of CSS layouts for this very reason because I can encrypt phpincludes that deal with layout and structure and NOT content so search engines done beat me up.

Because search engines frown on encryption in general, using a PHP Include or Require Once method to include your encrypted time lock code in the header of your template is one of the easier solutions. This of course does not always protect your code from view and anyone clever enough to figure out what you have done could simply remove the lines of code that include the time lock.

Final Notes

THE BIGGEST REASON IS GETTING PAID!

I’m extremely thorough in my design work as I follow a lengthy checklist of final requirements in all my work and many times people simply will not respect or appreciate that enough to pay you for the work you put in. Its always been my policy to never compete against discount or offshore designers from India or Pakistan (no pun intended). Many do not operate the Walmart of web design and protecting your work is essential. You may find yourself in a similar situation where people expect a Ferrari but are only willing to pay for a KIA and one way to insure you get paid is to deliver the template with a time lock with the ENTIRE key code source encrypted until you receive final payment. I rarely have the gut feeling to do this but when I feel someone is likely to burn me, in doing so I’ve saved myself a ton of headaches after delivering a final product to someone who feels you work for $1.50 an hour and finds no reason to pay you the balance.

Protecting code on a per domain basis without damaging your chance at search engine indexing will be the subject of a subsequent tutorial on how to lock your scripts on a per domain basis and then encrypt the lock snippet from alteration. Naturally we will also include dependencies to prevent people from removing your time locks and domain specific requirements which will send you an email upon modification attempts. I love that part because if someone trys to install your product or design on a non licensed domain you will receive an email of the offending domains location.

This is one of my favorite techniques in using remote code based on time lock or time settings wherein the timed out page would simply display a page I build to be displayed inside an iFrame. Upon expiration or invalid domain installation of your design an alternative to the time expiration message would display a page on the offending domain with links and credits back to your site. I’ve done this in tests but never live thus far largely because uncertainty on legalities of the practice.

So this pending tutorial is a lofty one and I’m pressed for time today but I will write on this in the very near future. Until then……

Comments

Leave a Comment

If you would like to make a comment, please fill out the form below.

You must be logged in to post a comment.


TEMP CODE: GDHXCDX17249629