PHP+Ajax 网站SEO查询工具 提供代码第1/3页
程序员文章站
2022-07-10 23:43:03
# name: php+ajax 网站seo查询工具 # author: 年华
# name: php+ajax 网站seo查询工具
# author: 年华<nianhua.liu@gmail.com> [q:4908220]
# homepage:http://master8.net
使用说明:
1.服务器必须至少支持allow_url_fopen,curl,fsockopen中的一种,具体请咨询服务器管理员。
2.请尊重别人的劳动成果!你可以任意修改并使用此程序,但不允许修改后公开发布!传播此程序亦应保持此压缩包完整性!
3.如果在使用中遇到任何问题,请访问提出以便得到解决。
ajax.js
// name: php+ajax 网站seo查询工具
// author: 年华<nianhua.liu@gmail.com> [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: 年华<nianhua.liu@gmail.com> [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;
?>
# author: 年华<nianhua.liu@gmail.com> [q:4908220]
# homepage:http://master8.net
使用说明:
1.服务器必须至少支持allow_url_fopen,curl,fsockopen中的一种,具体请咨询服务器管理员。
2.请尊重别人的劳动成果!你可以任意修改并使用此程序,但不允许修改后公开发布!传播此程序亦应保持此压缩包完整性!
3.如果在使用中遇到任何问题,请访问提出以便得到解决。
ajax.js
复制代码 代码如下:
// name: php+ajax 网站seo查询工具
// author: 年华<nianhua.liu@gmail.com> [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: 年华<nianhua.liu@gmail.com> [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;
?>
1
上一篇: PHP define函数的使用说明