Advertisement
Guest User

Untitled

a guest
Nov 7th, 2013
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.58 KB | None | 0 0
  1. <?php
  2. $domain = $_GET['domain'];
  3. $key = $_GET['key'];
  4. $ip = $_SERVER['REMOTE_ADDR'];
  5. $q = mysql_query("SELECT * from licenses where `key`='$key' LIMIT 1") or die(mysql_error());
  6. $o = mysql_fetch_object($q);
  7. $status = 0;
  8.  
  9. if($o==true){
  10.     if($o->multipleip==0){
  11.         if($domain == $o->domain){
  12.             if($o->expire =="" OR $o->expire > time()){
  13.                 if($o->serverip == ""){
  14.                     mysql_query("UPDATE `licenses` set `serverip`='$ip' where `id`='". $o->id ."'");
  15.                     logaction("IP of <font color='red'>$domain</font> changed to ". $ip);
  16.                 }
  17.                 if($o->status==0){
  18.                     $status = 1;
  19.                 }
  20.                 else
  21.                 {
  22.                     $status = 6;
  23.                 }
  24.             }
  25.             else
  26.             {
  27.                 $status = 3;
  28.             }
  29.        
  30.         }
  31.         else
  32.         {
  33.             $status = 7;
  34.         }
  35.         if($ip != $o->serverip){
  36.             if($o->serverip!=""){
  37.                 $status = 2;
  38.             }
  39.         }
  40.     }
  41.     else
  42.     {
  43.         $c = mysql_query("SELECT * from banned_hosts where `host`='".$domain."' or `ip`='". $ip. "' and `licenseid`='". $o->id ."'");
  44.         if(mysql_num_rows($c)==1){
  45.             $status = 5;
  46.             $ban = mysql_fetch_object($c);
  47.         }
  48.         else
  49.         {
  50.             $a = mysql_query("SELECT * from `known_hosts` where `host`='".$domain."' and `ip`='". $ip. "' and `licenseid`='". $o->id ."'") or die(mysql_error());
  51.             if(mysql_num_rows($a)==0){
  52.                 mysql_query("INSERT INTO `known_hosts` (`host`,`ip`,`created`,`licenseid`) VALUES('". $domain ."','". $ip ."', '". time() ."', '". $o->id ."')");
  53.             }
  54.             if($o->expire =="" OR $o->expire > time()){
  55.                 $status = 1;
  56.             }
  57.             else
  58.             {
  59.                 $status = 3;
  60.             }
  61.         }
  62.        
  63.     }
  64.     mysql_query("UPDATE `licenses` set `lastrequest`='". time() ."' where `id`='". $o->id ."'");
  65. }
  66. else
  67. {
  68. $status=4;
  69. }
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. if($status==1){
  77. echo "ok";
  78. }
  79. else
  80. {
  81. $html ='<html>
  82.         <head>
  83.         <style>
  84.         body {
  85.         font-family: arial,sans-serif;
  86.         background-image: url(apple_noise.jpg);
  87.         background-repeat: repeat-x;
  88.         background-color: #F6F6F8;
  89.         }
  90.         .error, .alert {
  91.         background: #FBE3E4;
  92.         color: #8A1F11;
  93.         border-color: #FBC2C4;
  94.         }
  95.         .error, .alert, .notice, .success, .info {
  96.         padding: 0.8em;
  97.         margin-bottom: 1em;
  98.         border: 2px solid #DDD;
  99.         }
  100.         </style>
  101.         <title>License Error</title></head>
  102.         <body>';
  103. switch($status){
  104.     case 2:
  105.         logaction("IP of <font color='red'>".$o->domain ."</font> changed from ". $o->serverip ." to ". $ip);
  106.         $msg = "Your server ip changed, this is not allowed by your license.<br />Please contact your admin for more information.<br />
  107.         Server ip: $ip  needed: $o->serverip <br />";
  108.     break;
  109.    
  110.     case 3:
  111.         $msg = "Your license has expired, please renew it";
  112.         logaction("<font color='red'>$domain</font> tried to use key <font color=red>'$key'</font>. But this license has expired");
  113.     break;
  114.    
  115.     case 4:
  116.         $msg = "Your license is invalid!<br />Please buy a valid license :)";
  117.         logaction("<font color='red'>$domain</font> tried to use key <font color=red>'$key'</font>.");
  118.     break;
  119.    
  120.     case 5:
  121.         $msg = "Your ip/host have been banned for this license.";
  122.         logaction("[Banned] <font color='red'>$domain</font> tried to use key <font color=red>'$key'</font>.");
  123.     break;
  124.  
  125.     case 6:
  126.         $msg = "Your license is not active.";
  127.         logaction("[Not active]<font color='red'>$domain</font> tried to use key <font color=red>'$key'</font>.");
  128.     break; 
  129.     case 7:
  130.         $msg = "Your server hostname changed, this is not allowed by your license.<br />Please contact your admin for more information.<br />
  131.         Domain: $domain needed: $o->domain";
  132.         logaction("<font color='red'>$domain</font> tried to use key <font color=red>'$key'</font> for domain $o->domain.");
  133.     break;
  134.  
  135. }
  136.        
  137. $html .= '<div id="login-error" class="error">'.$msg.'</div>';
  138.  
  139. echo $html;
  140.  
  141.  
  142.  
  143.  
  144. }
  145.  
  146. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement