//Judge the equipment is 1200 or not
if(substr($serial,0,3)=="014"){
global $db;
$mac = $_POST['mac']?$_POST['mac']:$_GET['mac'];
//Get OUI & judge the oui is or not
$customer_oui=substr($mac,0,6);
$data = $db->fetchNextObject($db->query("SELECT customer_id,code FROM `customer_table` WHERE
customer_id='{$customer_id}' and code='{$customer_oui}'" ));
if (empty($data))
{
$data = $db->fetchNextObject($db->query("SELECT customer_id,code FROM `customer_table` WHERE
customer_name='{$customer_id}' and code='{$customer_oui}'"));
if (empty($data))
{
echo $msg = "OUI is not exist";
return;
}
$cust_id=$data->customer_id;
}else{
$cust_id=$data->customer_id;
}
//Judge the oui is or not
if ($passwd != "itibia-lic-pass")
{
echo "password error";
return;
}
//create the 1200license file and make the user can download
if($download==1){
$mac=strtoupper($mac);
$md5_mac1=md5($mac);
$md5_mac2=md5($md5_mac1);
$md5_mac2_0=$md5_mac2."a19-=km,bEcd3235!#$deddk";
$md5_mac3=md5($md5_mac2_0);
$license_1200=substr($md5_mac3,strlen($md5_mac3)-13,strlen($md5_mac3));
//make the info insert into the license_1200_log_table
$sql = "INSERT INTO `license_1200_log_table` (`id`, `costomer_id`, `serpack`, `serial`, `mac`, `hd`,
`create_time`) VALUES (NULL, '".$cust_id."', '".$serpack_id."', '".$serial."', '".$mac."', '".$hd."',
NOW())";
$result = $db->query($sql);
$filename='1200license.lrc';
$encoded_filename = urlencode($filename);
$encoded_filename = str_replace("+", "%20", $encoded_filename);
// application/octet-stream为TXT类型文件 make it for many kind browser
header("Content-Type: application/octet-stream");
if (preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT']) ) {
header('Content-Disposition: attachment; filename="' . $encoded_filename . '"');
} elseif (preg_match("/Firefox/", $_SERVER['HTTP_USER_AGENT'])) {
header('Content-Disposition: attachment; filename*="' . $filename . '"');
} else {
header('Content-Disposition: attachment; filename="' . $filename . '"');
}
echo $license_1200;
}
exit;
}