+ Reply to Thread
Results 1 to 5 of 5

Thread: PHP License Script need help.

  1. #1
    Shadow121's Avatar
    Shadow121 is offline x10 Lieutenant Shadow121 is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    Centerville
    Posts
    455

    PHP License Script need help.

    Apparently this thing crashed a server 6 times and got two of my hosting accounts deleted. So, I asked the host owner person to help me make it so it can work on a shared server. I have no clue how to do so. Can someone help me?

    PHP Code:
    <?php
    require ("/home/joe/FileLibrary/configuration.inc.php");
    $lang['license_key_notfound'] = 'The key you have entered was not found.';
    $lang['license_invalid_domain'] = 'The domain in which the script is hosted on is invalid.';
    $lang['license_invalid_ip'] = 'The server IP address is not allowed to execute this script.';
    $lang['license_expired'] = 'The license in use for this script has expired.';

    $domain $db->protect($_GET['domain']);
    $ip $db->protect($_GET['ip']);
    $key $db->protect($_GET['key']);
    $getQuery $db->dbQuery("SELECT * FROM `" DB_PREFIX .
        
    "licenses` WHERE `key` = '$key';");
    switch (
    $_GET['act']) {
        default:
        case 
    'verify_license':
            if (
    $db->dbCount($getQuery) == 0) {
                die(
    $lang['license_key_notfound']);
            } else {
                
    $arrData $db->dbFetch($getQuery);
                
    $domainArr explode(","$arrData->allowed_domains);
                
    $ipArr explode(","$arrData->allowed_ips);
                if ((!
    in_array($domain$domainArr) && $arrData->allowed_domains != '*')) {
                    die(
    $lang['license_invalid_domain']);
                } else {
                    if ((!
    in_array($ip$ipArr) && $arrData->allowed_ips != '*') || (!is_array($ipArr) &&
                        
    $arrData->allowed_ips != '*')) {
                        die(
    $lang['license_invalid_ip']);
                    } else {
                        if (
    $arrData->expirey_date date("Ymd") && $arrData->expirey_date != 'never') {
                            die(
    $lang['license_expired']);
                        }else{
                            die(
    "Okay!");
                        }
                    }
                }
            }
            break;
        case 
    'script_info':
            if (
    $db->dbCount($getQuery) == 0) {
                die(
    $lang['license_key_notfound']);
            } else {
                
    $arrData $db->dbFetch($getQuery);
                
    $domainArr explode(","$arrData->allowed_domains);
                
    $ipArr explode(","$arrData->allowed_ips);
                if ((!
    in_array($domain$domainArr) && $arrData->allowed_domains != '*')) {
                    die(
    $lang['license_invalid_domain']);
                } else {
                    if ((!
    in_array($ip$ipArr) && $arrData->allowed_ips != '*') || (!is_array($ipArr) &&
                        
    $arrData->allowed_ips != '*')) {
                        die(
    $lang['license_invalid_ip']);
                    } else {
                        if (
    $arrData->expirey_date date("Ymd") && $arrData->expirey_date != 'never') {
                            die(
    $lang['license_expired']);
                        }else{
                            if (
    $arrData->show_info == 1) {
                                die(
    "yes");
                            }else{
                                die(
    "no");
                            }
                        }
                    }
                }
            }
            break;
        case 
    'license_info':
            if (
    $db->dbCount($getQuery) == 0) {
                die(
    $lang['license_key_notfound']);
            } else {
                
    $arrData $db->dbFetch($getQuery);
                
    $domainArr explode(","$arrData->allowed_domains);
                
    $ipArr explode(","$arrData->allowed_ips);
                if ((!
    in_array($domain$domainArr) && $arrData->allowed_domains != '*')) {
                    die(
    $lang['license_invalid_domain']);
                } else {
                    if ((!
    in_array($ip$ipArr) && $arrData->allowed_ips != '*') || (!is_array($ipArr) &&
                        
    $arrData->allowed_ips != '*')) {
                        die(
    $lang['license_invalid_ip']);
                    } else {
                        if (
    $arrData->expirey_date date("Ymd") && $arrData->expirey_date != 'never') {
                            die(
    $lang['license_expired']);
                        }else{
                            die(
    "Script created by ".$arrData->script_author." at <a href=\"".$arrData->script_com_link."\">".$arrData->script_company."</a>");
                        }
                    }
                }
            }
            break;
    }
    ?>
    This is the licensing thing that lets a script to connect back.
    PHP Code:
    <?php
    define
    ("LICENSE_KEY","4T7P-M1U-9B1-717F");
    function 
    get_license($action null)
    {
        
    $url "http://licensing.codingdev.net/serv.php?act=$action&key=".LICENSE_KEY."&domain=".$_SERVER['HTTP_HOST']."&ip=".$_SERVER['SERVER_ADDR'];
        
    $options = array(
            
    CURLOPT_USERAGENT => $domain "(" $ip ") LICENSE CHECK",
            
    CURLOPT_CONNECTTIMEOUT => 60,
            
    CURLOPT_RETURNTRANSFER => 1,
            
    CURLOPT_TIMEOUT => 60,
            );
        
    $ch curl_init($url);
        
    curl_setopt_array($ch$options);
        
    $content curl_exec($ch);
        
    curl_close($ch);
        return 
    $content;
    }
    #Get general license information
    $license_check get_license('verify_license');
    switch(
    $license_check)
    {
        default:
            die(
    $license_check);
            break;
        case 
    'Okay!':
            
    //Do Nothing
            
    break;
    }
    print 
    "Hello World!";
    $info_check get_license("script_info");
    if(
    $info_check == 'yes'){
        
    $license_info get_license('license_info');
        print 
    "<br /><br /><code>".$license_info."</code>";
    }
    ?>
    Last edited by Shadow121; 10-05-2010 at 12:30 PM.

  2. #2
    cybrax's Avatar
    cybrax is offline x10 Elder cybrax is on a distinguished road
    Join Date
    Aug 2009
    Location
    UK
    Posts
    699

    Re: PHP License Script need help.

    What does the file "configuration.inc.php" contain / do?
    The code must flow.
    Project 157: Latest UK Jobs direct to your mobile phone
    New Domain under construction: Lovelogic.net
    home for some new projects that we can't keep here ;)


  3. #3
    Shadow121's Avatar
    Shadow121 is offline x10 Lieutenant Shadow121 is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    Centerville
    Posts
    455

    Re: PHP License Script need help.

    The configuration.inc.php file contains all the calls to connect to the database, initialize the language system, PHP IP Filters and blacklist checks.

  4. #4
    cybrax's Avatar
    cybrax is offline x10 Elder cybrax is on a distinguished road
    Join Date
    Aug 2009
    Location
    UK
    Posts
    699

    Re: PHP License Script need help.

    Quote Originally Posted by Shadow121 View Post
    The configuration.inc.php file contains all the calls to connect to the database, initialize the language system, PHP IP Filters and blacklist checks.

    If the script is downing the server this is where I would start looking for answers in the abscence of any meaningful error codes from the server.

    Split the config file into seperate chunks and check each one in turn starting with the basic connections to the database and include the others one at a time.

    Just a thought why cannot IP filtering and blacklist be handled by htaccess file?
    The code must flow.
    Project 157: Latest UK Jobs direct to your mobile phone
    New Domain under construction: Lovelogic.net
    home for some new projects that we can't keep here ;)


  5. #5
    Shadow121's Avatar
    Shadow121 is offline x10 Lieutenant Shadow121 is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    Centerville
    Posts
    455

    Re: PHP License Script need help.

    I'm using Xip which is a class from PHP-Classes. The lacklist checker goes out to SpamCop and SpamHaus since simple IP blocking won't make sure they aren't spammers etc. yeah htaccess can handle IP blocking but I'm not the type of person to log into cPanel or an equivalent just to ban someone every time its needed. For example, I'm helping run a site with a contact form with Captcha. The bots, or person running them have adapted to the captcha. At times there are ~30+ messages of spam. A php script may prove helpful, especially if you don't have cPanel access.

    How do you propose checking? Add a die with the execution time after each part?

+ Reply to Thread

Similar Threads

  1. IPB License for Sale
    By Hermoine22 in forum Ads & Offers
    Replies: 5
    Last Post: 04-17-2010, 11:48 AM
  2. [OFF] ZoneAlarm Pro License Key
    By Danielx386 in forum The Marketplace
    Replies: 0
    Last Post: 10-29-2009, 06:02 PM
  3. Unused VB license
    By Eric@TLG in forum Off Topic
    Replies: 22
    Last Post: 01-24-2008, 05:55 PM
  4. IPB License
    By Tetly in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 08-03-2006, 11:34 AM
  5. [REQ] Vb License
    By Fire Wolf in forum The Marketplace
    Replies: 3
    Last Post: 04-13-2006, 12:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers