<?php

//启用某个序列号
if( isset($_GET['key']) )
{ 
  $licensekey = $_GET['key'];    
}
else
{	
  print_r("没有输入序列号!");
  exit;
}
if( isset($_GET['ctrl']) )
{ 
  $ctrl = $_GET['ctrl'];    
}
else
{	
  print_r("没有控制命令!");
  exit;
}

if (strcmp($ctrl,'enable')==0) 
{
  print_r("启用序列号!");
  $Expired=0;
}

if (strcmp($ctrl,'disable')==0) 
{
  print_r("禁用序列号!");
  $Expired=1;
}

//连接MySQL
$conn = @mysql_connect("localhost", "gili0512", "nIJ9qatVBLKS");

if($conn == FALSE)
{	
  print_r("连接数据库失败!");
  exit;
}

//选择数据库
mysql_select_db("gili0512_livecheck");

//执行SQL
$result = @mysql_query("SELECT * FROM gslicenseinfo where RegKey='$licensekey'");

if(mysql_num_rows($result) > 0)
{
  While($row = mysql_fetch_array($result))
  {
     // print_r($row["id"].",".$row["RegCode"].",".$row["Activations"].",".$row["IsExpired"]);
     //print_r("<br />");

     $RegCode=$row["RegKey"];
     //print_r($Activations);
     
     $result = mysql_query("UPDATE gslicenseinfo SET IsExpired = '$Expired' WHERE RegKey = '$RegCode'");

     if(mysql_affected_rows() > 0)
     {
       print_r("成功");
     } 
  }
}
else
{
  print_r("没找到该序列号！");
}

//释放结果集
mysql_free_result($result);

//关闭连接
mysql_close();


?> 
