Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $domain = $_GET['domain'];
- $key = $_GET['key'];
- $ip = $_SERVER['REMOTE_ADDR'];
- $q = mysql_query("SELECT * from licenses where `key`='$key' LIMIT 1") or die(mysql_error());
- $o = mysql_fetch_object($q);
- $status = 0;
- if($o==true){
- if($o->multipleip==0){
- if($domain == $o->domain){
- if($o->expire =="" OR $o->expire > time()){
- if($o->serverip == ""){
- mysql_query("UPDATE `licenses` set `serverip`='$ip' where `id`='". $o->id ."'");
- logaction("IP of <font color='red'>$domain</font> changed to ". $ip);
- }
- if($o->status==0){
- $status = 1;
- }
- else
- {
- $status = 6;
- }
- }
- else
- {
- $status = 3;
- }
- }
- else
- {
- $status = 7;
- }
- if($ip != $o->serverip){
- if($o->serverip!=""){
- $status = 2;
- }
- }
- }
- else
- {
- $c = mysql_query("SELECT * from banned_hosts where `host`='".$domain."' or `ip`='". $ip. "' and `licenseid`='". $o->id ."'");
- if(mysql_num_rows($c)==1){
- $status = 5;
- $ban = mysql_fetch_object($c);
- }
- else
- {
- $a = mysql_query("SELECT * from `known_hosts` where `host`='".$domain."' and `ip`='". $ip. "' and `licenseid`='". $o->id ."'") or die(mysql_error());
- if(mysql_num_rows($a)==0){
- mysql_query("INSERT INTO `known_hosts` (`host`,`ip`,`created`,`licenseid`) VALUES('". $domain ."','". $ip ."', '". time() ."', '". $o->id ."')");
- }
- if($o->expire =="" OR $o->expire > time()){
- $status = 1;
- }
- else
- {
- $status = 3;
- }
- }
- }
- mysql_query("UPDATE `licenses` set `lastrequest`='". time() ."' where `id`='". $o->id ."'");
- }
- else
- {
- $status=4;
- }
- if($status==1){
- echo "ok";
- }
- else
- {
- $html ='<html>
- <head>
- <style>
- body {
- font-family: arial,sans-serif;
- background-image: url(apple_noise.jpg);
- background-repeat: repeat-x;
- background-color: #F6F6F8;
- }
- .error, .alert {
- background: #FBE3E4;
- color: #8A1F11;
- border-color: #FBC2C4;
- }
- .error, .alert, .notice, .success, .info {
- padding: 0.8em;
- margin-bottom: 1em;
- border: 2px solid #DDD;
- }
- </style>
- <title>License Error</title></head>
- <body>';
- switch($status){
- case 2:
- logaction("IP of <font color='red'>".$o->domain ."</font> changed from ". $o->serverip ." to ". $ip);
- $msg = "Your server ip changed, this is not allowed by your license.<br />Please contact your admin for more information.<br />
- Server ip: $ip needed: $o->serverip <br />";
- break;
- case 3:
- $msg = "Your license has expired, please renew it";
- logaction("<font color='red'>$domain</font> tried to use key <font color=red>'$key'</font>. But this license has expired");
- break;
- case 4:
- $msg = "Your license is invalid!<br />Please buy a valid license :)";
- logaction("<font color='red'>$domain</font> tried to use key <font color=red>'$key'</font>.");
- break;
- case 5:
- $msg = "Your ip/host have been banned for this license.";
- logaction("[Banned] <font color='red'>$domain</font> tried to use key <font color=red>'$key'</font>.");
- break;
- case 6:
- $msg = "Your license is not active.";
- logaction("[Not active]<font color='red'>$domain</font> tried to use key <font color=red>'$key'</font>.");
- break;
- case 7:
- $msg = "Your server hostname changed, this is not allowed by your license.<br />Please contact your admin for more information.<br />
- Domain: $domain needed: $o->domain";
- logaction("<font color='red'>$domain</font> tried to use key <font color=red>'$key'</font> for domain $o->domain.");
- break;
- }
- $html .= '<div id="login-error" class="error">'.$msg.'</div>';
- echo $html;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement