۱۳۹۰/۶/۳۱، ۱۸:۱۷:۴۳ عصر
دوستان من بعد از اينكه كلي دنبال يه سايت مپ گشتم ديدم آب د ركوزه و ما گرد جهان ميگرديم :d سايت ماي بي بي يك پلاگين سايت مپ گذاشته بود همه چيز اين پلاگين درست كار ميكنه اما براي submit كردنش در گوگل با ارور مواجه ميشم ميگه كه Invalid URL
This is not a valid URL. Please correct it and resubmit. و خطا رو از خط چهارم تشخيص ميده ، كسي ميدونه اين مشكل مربوط به چيه ؟؟ اينم كد sitemap.php
ممنون.
This is not a valid URL. Please correct it and resubmit. و خطا رو از خط چهارم تشخيص ميده ، كسي ميدونه اين مشكل مربوط به چيه ؟؟ اينم كد sitemap.php
ممنون.
کد php:
<?php
//Output will be an XML Doc
header("Content-Type: text/xml");
//Hook into MyBB
define("IN_MYBB", 1);
require_once("./global.php");
//Check if SEO URLs are active
$result = mysql_query("SELECT * FROM ".TABLE_PREFIX."settings WHERE name = 'seourls'");
if(mysql_num_rows($result) > 0){
$row = mysql_fetch_assoc($result);
if($row['value'] == "no"){
$seoactive = 0;
}else{
$seoactive = 1;
}
}else{
$seoactive = 0;
}
function getRemoteIP ()
{
// check to see whether the user is behind a proxy - if so,
// we need to use the HTTP_X_FORWARDED_FOR address (assuming it's available)
if (strlen($_SERVER["HTTP_X_FORWARDED_FOR"]) > 0) {
// this address has been provided, so we should probably use it
$f = $_SERVER["HTTP_X_FORWARDED_FOR"];
// however, before we're sure, we should check whether it is within a range
// reserved for internal use (see http://tools.ietf.org/html/rfc1918)- if so
// it's useless to us and we might as well use the address from REMOTE_ADDR
$reserved = false;
// check reserved range 10.0.0.0 - 10.255.255.255
if (substr($f, 0, 3) == "10.") {
$reserved = true;
}
// check reserved range 172.16.0.0 - 172.31.255.255
if (substr($f, 0, 4) == "172." && substr($f, 4, 2) > 15 && substr($f, 4, 2) < 32) {
$reserved = true;
}
// check reserved range 192.168.0.0 - 192.168.255.255
if (substr($f, 0, 8) == "192.168.") {
$reserved = true;
}
// now we know whether this address is any use or not
if (!$reserved) {
$ip = $f;
}
}
// if we didn't successfully get an IP address from the above, we'll have to use
// the one supplied in REMOTE_ADDR
if (!isset($ip)) {
$ip = $_SERVER["REMOTE_ADDR"];
}
// done!
return $ip;
}
//Log this visit
$db->insert_query("sitemap_crawls",
array(
"useragent" => $_SERVER['HTTP_USER_AGENT'],
"remoteip" => getRemoteIP(),
"timestamp" => time()
)
);
$itemcount = 0;
$items = array();
//Dont forget the homepage
$now = date(c);
$items[$itemcount] = Array('loc'=>$mybb->settings['homeurl'],'lastmod'=>$now,'priority'=>'1','changefreq'=>'daily');
$itemcount++;
//Get Threads
$result = mysql_query("SELECT * FROM ".TABLE_PREFIX."threads ORDER BY tid DESC");
while($thread = mysql_fetch_array($result)){
if($seoactive == 0){
$threadfilename = "showthread.php?tid=".$thread['tid'];
}else{
$threadfilename = "thread-" . $thread['tid'] . ".html";
//$threadfilename = strtolower(str_replace(" ","-",str_replace(array("&","*","^","?","#",":","!",";","$","£"),"",$thread['subject'])))."-t-".$thread['tid'].".html";
}
$lastmod = date(c,$thread['lastpost']);
$items[$itemcount] = Array('loc'=>$mybb->settings['homeurl']."/".$threadfilename,'lastmod'=>$lastmod,'priority'=>'0.5','changefreq'=>'daily');
$itemcount++;
}
//Get Forums
$result = mysql_query("SELECT * FROM ".TABLE_PREFIX."forums ORDER BY fid DESC");
while($forum = mysql_fetch_assoc($result)){
if($seoactive == 0){
$forumfilename = "forumdisplay.php?fid=".$forum['fid'];
}else{
$forumfilename = "forum-" . $forum['fid'] . ".html";
}
$lastmod = date(c, $forum['lastpost']);
$items[$itemcount] = Array('loc'=>$mybb->settings['homeurl']."/".$forumfilename,'lastmod'=>$lastmod,'priority'=>'0.5','changefreq'=>'daily');
$itemcount++;
}
//So now we have all of our items, build the sitemap
echo<<<END
<?xml version="1.0" encoding="UTF-8"?>
<!-- Auto Sitemap for MyBB by Goughy000 -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
END;
foreach($items AS $item){
echo "\t<url>\r\n";
echo "\t\t<loc>".$item['loc']."</loc>\r\n";
echo "\t\t<lastmod>".$item['lastmod']."</lastmod>\r\n";
echo "\t\t<priority>".$item['priority']."</priority>\r\n";
echo "\t\t<changefreq>".$item['changefreq']."</changefreq>\r\n";
echo "\t</url>\r\n";
}
?>
</urlset>