PHP Classes

File: app/

Recommend this page to a friend!
  Classes of Oliver Lillie  >  PADL (PHP Application Distribution License System)  >  app/  >  Download  
File: app/
Role: Example script
Content type: text/plain
Description: Demo file
Class: PADL (PHP Application Distribution License System)
Generate PHP application license keys
Author: By
Last change: name change
Date: 11 years ago
Size: 4,865 bytes


Class file image Download

    * Project: Distrubution License Class
    * File:
    * Copyright (C) 2005 Oliver Lillie
    * This program is free software; you can redistribute it and/or modify it
    * under the terms of the GNU General Public License as published by the Free
    * Software Foundation; either version 2 of the License, or (at your option)
    * any later version.
    * This program is distributed in the hope that it will be useful, but
    * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
    * for more details.
    * You should have received a copy of the GNU General Public License along
    * with this program; if not, write to the Free Software Foundation, Inc.,
    * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    * @link
    * @link
    * @author Oliver Lillie, buggedcom <publicmail at buggedcom dot co dot uk>
    * @history---------------------------------------------
    * see CHANGELOG
    # BY THE demo.generate.license.php SCRIPT. PLEASE RUN THAT FILE BEOFRE THIS

    # this file demonstrates several important security techniques
    # that should be employed within your app's license validation
    # methods
    # 1) -----------------------------------------------------------------------
    # you should always encode your applications using such a product as ionocube,
    # or source guardian.
    # 2) -----------------------------------------------------------------------
    # always copy the $_SERVER vars before including any public files (by
    # public i mean any files that the client has access to, ie lang files or
    # opensource classes). Ideally the license validation script should be carried
    # out before any imporation of language files, however i know that is not
    # always possible so hence this work around.
$server_array = $_SERVER;
# 3) -----------------------------------------------------------------------
    # you should always check that the classes exist, otherwise terminate the script
if(@!file_exists('../shared/class.license.lib.php') || @!is_file('../shared/class.license.lib.php')) die('Missing File > ../shared/class.license.lib.php');
file_exists('') || @!is_file('')) die('Missing File >');
# import the classes
# 4) -----------------------------------------------------------------------
    # check to see if the classes exist
if(!class_exists('padl') || !class_exists('license_application')) die('Class code missing.');

# initialise the class
$application = new license_application('license.generated.dat', false, true, true, true);

# set the server vars
# validate the license key
$results = $application->validate();

# 5) -----------------------------------------------------------------------
    # once the validation has been carried out there should be no need to run
    # any other scripts. thus by running make_secure() you are wiping all the
    # values from the class and defining a var that terminates the script if
    # any important functions are called or a new instance of the class is
    # redeclared or inited.
    # by setting the param to true you can report any violations of this to your
    # licensing server. Note the violations detected are only function accesses
    # or redeclarations of the classes, not
# inclusion of lang file for outputing errors and other text.
    # you should look inside the lang file as it contains some security tests you
    # can run to see how make_secure function works, this must always be below
    # the make_secure function call, otherwise there are major security
    # implications in the strength of your key

# 6) -----------------------------------------------------------------------
    # switch through the results of the validation. This is the main one. If you
    # don't check the validation results, what is the point of using this class!
'OK' :
        default :
# 5) -----------------------------------------------------------------------
    # this is really just a tidyup but is worth it, delete the active padl object
# this would be where you would start including public files in an optimum situation
    # include_once('');