<?php


function read_reg($url,$reg){
  if(preg_match($reg,read_file($url),$m)){
	return $m[1];
  }
  return false;
}



@ require ('readonly/function/confirm_power.php');
define('POWER', confirm_power());

if (POWER != 5) {
  err('<script> alert("该命令必须以基本管理员身份登陆！请重登陆"); </script>');
}

@ require ('readonly/function/read_file.php');
@ require ('readonly/function/pr_alexa.php');


$website = preg_replace('/https?\:\/\//i', '', $_GET['siteurl']);
$website = preg_replace('/\/?$/i', '', $website);
$prv = get_pagerank(urlencode($website));
echo '<script> try{parent.$(\'site_'.urlencode($_GET['siteurl']).'\').innerHTML=\'PR:'.preg_replace('/[\r\n]+/', '', $prv).' \';}catch(e){} </script>';

$alexa = getAlexaRank(urlencode($website));
echo '<script> try{parent.$(\'site_'.urlencode($_GET['siteurl']).'\').innerHTML+=\'Alexa:'.preg_replace('/[\r\n]+/', '', $alexa).' \';}catch(e){} </script>';

$shoulu = read_reg('http://www.baidu.com/s?ie=utf-8&word=site%3A'.urlencode($website).'', '/('.preg_quote($website, '/').'\/(\s|&nbsp;)+)/is');
echo '<script> try{parent.$(\'site_'.urlencode($_GET['siteurl']).'\').innerHTML+=\'首页:百度'.($shoulu ? '已' : '未').'收录\';}catch(e){} </script>';
unset($website);

?>