<?php
class cpp {
    const SALT = '8g%r9HDve*';

    public static function checkLicense($key) {
        try {
            if(empty($_SERVER['HTTP_HOST'])) {
                throw new Exception("Invalid host.");
            }
            if(md5(self::SALT . md5($_SERVER['HTTP_HOST'])) != $key && (!preg_match('/^www\./', $_SERVER['HTTP_HOST']) && md5(self::SALT . md5('www.' . $_SERVER['HTTP_HOST'])) != $key )) {
                throw new Exception("Invalid license key.");
            }
            return true;

        } catch (\Exception $e) {
            return false;
        }
    }
}