<?php

//插入序列号到数据库
if( isset($_GET['key']) )
{ 
   $regKey = $_GET['key'];    
}
else
{
  print_r("没有输入序列号!");
  exit;
}

if( isset($_GET['mail']) )
{ 
  $email = $_GET['mail'];    
}
else
{
  print_r("没有输入邮箱!");
  exit;
}

if( isset($_GET['os']) )
{ 
  $os = $_GET['os'];    
}
else
{
  print_r("没有输入系统!");
  exit;
}

if( isset($_GET['lan']) )
{ 
  $lan = $_GET['lan'];    
}
else
{
  print_r("没有输入语言!");
  exit;
}

if( isset($_GET['mac']) )
{ 
  $netMac = $_GET['mac'];    
}
else
{
  print_r("没有输入语言!");
  exit;
}
 

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

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

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

//执行SQL
$result = @mysql_query("SELECT * FROM gsemailinfo where netMAC='$netMac' and RegKey='$regKey' ");

//显示查询结果
 
if(mysql_num_rows($result) > 0)//已经激活过
{
	 $result = @mysql_query("INSERT INTO gslicenseinfo(id,RegKey,IsExpired) VALUES (0, '$regKey',0)");
	print_r("success");
}
else
{

	//执行SQL
	$result = @mysql_query("INSERT INTO gsemailinfo(id,RegKey,Email,OS,Language,netMAC) VALUES (0, '$regKey','$email','$os','$lan','$netMac')");
	$result = @mysql_query("INSERT INTO gslicenseinfo(id,RegKey,IsExpired) VALUES (0, '$regKey',0)");

	//显示查询结果
	if ($result)
	{
 	 print_r("success");
	}
	else
	{
 	 print_r("failed");
	}
}

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

//关闭连接
mysql_close();


?> 
