# Name: PHP+Ajax 網站SEO查詢工具
# Author: 年華<[email protected]> [Q:4908220]
# Homepage:http://master8.net
使用說明:
1.服務器必須至少支持allow_url_fopen,curl,fsockopen中的一種,具體請咨詢服務器管理員。
2.請尊重別人的勞動成果!你可以任意修改並使用此程序,但不允許修改後公開發布!傳播此程序亦應保持此壓縮包完整性!
3.如果在使用中遇到任何問題,請訪問http://master8.net/bbs/提出以便得到解決。
ajax.js
復制代碼 代碼如下:
// Name: PHP+Ajax 網站SEO查詢工具
// Author: 年華<[email protected]> [Q:4908220]
// Notice: Use It After READ readme.txt
// (c) 2007 www.master8.net
var xmlHttp;
function makeRequest(queryString) {
var msXml = new Array();
msXml[0] = "Microsoft.XMLHTTP";
msXml[1] = "MSXML2.XMLHTTP.5.0";
msXml[2] = "MSXML2.XMLHTTP.4.0";
msXml[3] = "MSXML2.XMLHTTP.3.0";
msXml[4] = "MSXML2.XMLHTTP";
if (window.xmlHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else {
for (var i = 0; i < msXml.length; i++) {
try {
xmlHttp = new ActiveXObject(msXml[i]);
break;
} catch (e) {
xmlHttp = new xmlHttpRequest();
}
}
}
xmlHttp.onreadystatechange = getRequest;
xmlHttp.open('post', 'seo.php', true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.send(queryString);
}
function getRequest() {
if(xmlHttp.readyState==4) {
if(xmlHttp.status==200) {
$('seo_result').innerHTML = xmlHttp.responseText;
}
}
}
seo.php
復制代碼 代碼如下:
<?php
# Name: PHP+Ajax 網站SEO查詢工具
# Author: 年華<[email protected]> [Q:4908220]
# Notice: Use It After READ readme.txt
# (c) 2007 www.master8.net
define('IN_SEO', TRUE);
error_reporting(E_ERROR);
set_time_limit(0);
isset($_SERVER['HTTP_REFERER']) or exit('Invalid Request');
preg_match("/".$_SERVER['HTTP_HOST']."/i", $_SERVER['HTTP_REFERER']) or exit('Access Denied');
header("Content-Type:text/html;charset=gb2312");
include './robot.php';
require './function.php';
@extract($_POST);
isset($job) && isset($domain) or exit('Invalid Request');
$domain = strtolower($domain);
is_domain($domain) or exit('Invalid Domain');
$jobs=array('google','baidu','yahoo','msn','sogou','iask','so163','zhongsou','vnet');
$result = '';
if(in_array($job, $jobs))
{
$result = get_seo_info($domain, $job);
}
elseif($job == 'alexa')
{
$result = Alexa($domain);
}
elseif($job == 'chinarank')
{
$result = ChinaRank($domain);
}
elseif($job == 'pagerank')
{
$result = '<img src="./images/pagerank'.PageRank($domain).'.gif" align="absmiddle" /> '.$domain;
if(substr($domain, 0, 4) == 'www.')
{
$domain = substr($domain, 4);
$result.= ' <img src="./images/pagerank'.PageRank($domain).'.gif" align="absmiddle" /> '.$domain;
}
}
elseif($job == 'sogourank')
{
$result = sogouRank($domain).' '.$domain;
if(substr($domain, 0, 4) == 'www.')
{
$domain = str_replace("www.", '', $domain);
$result = $result.' '.sogouRank($domain).' '.$domain;
}
}
!empty($result) or exit('Invalid Request');
echo '<img src="./images/yes.gif" align="absmiddle" /> '.$result;
?>