如题这是一段php的域名是否授权代码,有没有办法改成js的
error_reporting(0);
function getTopDomainhuo(){
$host=$_SERVER['HTTP_HOST'];
$matchstr="[^\.]+\.(?:(".$str.")|\w{2}|((".$str.")\.\w{2}))$";
if(preg_match("/".$matchstr."/ies",$host,$matchs)){
$domain=$matchs['0'];
}else{
$domain=$host;
}
return $domain;
}
$domain=getTopDomainhuo();
$check_host = 'https://token.su1018.cn/update.php';
$client_check = $check_host . '?a=client_check&u=' . $_SERVER['HTTP_HOST'];
$check_message = $check_host . '?a=check_message&u=' . $_SERVER['HTTP_HOST'];
$check_info=file_get_contents($client_check);
$message = file_get_contents($check_message);
if($check_info=='1'){
echo '<font color=red>' . $message . '</font>';
die;
}elseif($check_info=='2'){
echo '<font color=red>' . $message . '</font>';
die;
}elseif($check_info=='3'){
echo '<font color=red>' . $message . '</font>';
die;
}
unset($domain);