How To Expire Template Demos with PHP - Revisited
Posted on September 1, 2007
Filed Under Design |
Time lock code for template demonstrations using PHP
Periodically I’ll have someone ask if they can demo one of the designs on their server to verify that some of the more complex examples of my designs will work on their hosting account. Its not really an unusual request given the complexity of some of the code and requirements involved so I usually accommodate such requests. My favorite method in doing so is to simply employ a few code snippets to expire the demo at a set period of time or to lock the element for a specific domain.
For the most part, simply posting a template or live demo at http://www.livedemosite.com would be sufficient but when I add code to templates for specific needs, it can be required to customize the HTACCESS file or even server side includes to have some of the more advanced features work properly. This is certainly true in one version of my PagePeel effect. So it should be evident that a time locked demo is certainly the most efficient way to help my customers evaluate my products.
Time locking with PHP isn’t anything new per se` and fundamentals rarely if ever die so using the technique is efficient and effective in keeping that fundamental objective in the realm of the possible. Since my objective is pretty clear, to demo a complex template in hopes of a purchase, using this php snippet achieves my objective easily and cleanly. Naturally expiry code can insure you get paid as well.
Your initial thought might be that such a technique could be easily defeated rendering the whole idea moot. Its certainly true that almost any attempt to protect code can be cracked or usurped with enough tenacious effort. So by adding a few additional safe guards and steps you reduce the risk of losing your work to a would be dishonest person.
A quick look at the issue of ethics and honesty - victims of fraud
Before we get to the code lets face the facts for a moment; Any designer or developer who has been in this business long enough, knows all to well that their code is going to be jacked eventually. Its arrogance and presumption to believe otherwise most of the time.
In this business you could spend weeks building a beautiful web site solution packed with features and exhaustive creative expressions of your experience, only to have some wise guy issue a charge back on his credit card a few weeks later. This happened to me once when I had forgotten to make final changes to the robots.txt file that prevented the development directories from being indexed by search engines. Rather than just email me or call me to have me fix the issue, this person saw fit to charge back nearly $1,800 putting me in a troubling situation. These kinds of things will happen if you do design work long enough.
Ethics is the one big thing you can’t enforce upon others nor do you have the ability to encourage them effectively in hopes of not getting burned. Its my belief that every person I come in contact with is essentially a good person until demonstrated otherwise. So its nothing personal when provisions are setup to protect you from potential fraud and doing so should be a part of your business SOP (standard operating procedure). Lets look at the code.
PHP and Encryption to expire templates
The concept is simply this; By using the UNIX server time as the starting point for the expiry code, you create a target period in the future that the code stops working with a simple variable. Then, you encrypt the code along with enough of the template to render it unusable or editable. So you have a template for instance and you want to dish up a free demo of it and you chose to use either a time lock method or a domain lock method or even both. The very first thing we need is a starting point in time and to do that we get the server time by simply creating a php file called, servertime.php with the following code;
<?php
//this simply echos the unix time for the first variable of our code
echo time();
?>
Once uploaded to your server and accessed via your browser, you should see echoed back the server time that would look as follows; 1188670432 We’re really not going to take into account the provisions for such things as timezones as this can be easily adjusted for in our next step.
Now what we want to do is apply that server time to the $start_trial var as follows.
<?php
$start_trial = 1188670432;
$end_trial = $start_trial + 604800;
$current_time = time();
$remaining_trial = $end_trial - $current_time;
if ($current_time > $end_trial) {
die(‘Your demo has expired. Please visit,
<a href=”http://www.jaredritchey.com” target=”_blank”>Jared Ritchey
</a> You will then receive the unlock files’);
}
?>
Next we need to create the period of time the code is valid for before it expires and that number would be entered into the variable $end_trial This is essentially a time period broken down into seconds. So if for instance you wanted the period to expire in 7 days for a 7 day template demo then you would simply multiply days by hours by minutes by seconds. Therefore 7×24x60×60=604800 for a 7 day trial, you would add 604800 to the $end_trial variable in the code above.
Next, using the SEGMENT encryption option in the CodelockV2 Encrypting Tool for PHP, you simply paste in your code and press the encrypt button. The resulting code would then be pasted into the final file. (DONT FORGET TO SAVE AN ORIGINAL unencrypted version)
Now to make this effective at all, you should paste in the code above after you edit the time elements into your template somewhere in the header and then copy and paste a large portion of your template code into the encryption tool. This will prevent someone from just deleting the time lock code rendering the template useless.
Once uploaded to a PHP capable server the code will expire and then echo the message you wish to convey. You should keep in mind that being offensive in your message could prove disastrous to your career so prudence and decency is advised. There are a few other little things you could do in addition which we can briefly look at next.
Some additional methods of protecting your template work
Every single template club or code club I see online today requires that a person purchasing access wait at least 24 hours to stay potential credit card and PayPal issues of misuse. With the rampant issue of PayPal fishing, many accounts end up compromised and used for the purchase of items on the web. Fraud purveyors readily seek opportunity to purchase software and solutions with stolen PayPal credentials where instant downloads make the likeliness of success quite high.
Requiring purchases for down-loadable products either dependent on domain locking, time locking or time period before download will help you reduce the risk of fraudulent purchases.
Having a well written and clear policy for purchases can keep PayPal on your side when disputes do arise as the result of those that seek to defraud you. There are dozens of things you can employ to help safeguard you from potential abuse, but the easiest rules that seem to be most widely employed are some type of encrypted coding for domain locking, expiry, or email address licensing that must first be verified.
In an upcoming set of posts I’ll cover a few procedural practices that will keep you in a position to effectively conduct business on the internet and avoid legal complications. A solid SDOP (standard designers operating procedure) would be a good start as I will explore in these articles. Until then, happy blogging.
Comments
Leave a Comment
If you would like to make a comment, please fill out the form below.
Shopping Cart
Shopping Cart
Visit the shop
Recently
- WordPress Featured Listings Plugin v1.0.2
- Realtor Blogs Themes - The Brokers Edge
- WP Featured Listings Plugin Download
- AWBS Template Tool
- Kissing Freelance Goodbye!
- NEW Production Workstation
- The Spin on Vapor-Ware
- No Rivalry! Open Realty EZ Pro Realty
- Joomla and AWBS Bridge
- Updating - Upgrading to WordPress 2.5
Categories
- Code Snippets
- Design
- Open Realty
- Portfolio
- Products
- Products in Review
- Products in Review
- Professionals In Review
- Real Estate News
- Real Estate Websites
- Technical Resources
- Template Design Kit
- Uncategorized
- Week in Review
- WordPress Wisdom
Archives
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007