90% of the mod:
V@no/JanA part of this mod was already published in this forum, but unfortunately it got lost after the hack.
Step 1: Create new users called for example "searchbot" and "googlebot" (or any other aditional you want...) with password "12345"
(you may use any username or password you want, but then you will need to change the code)
The password 12345 is just for "demonstration" - please use another one for your bots and replace 12345 in the code with your new password...
If you decide not to do that, everybody can visit your page as a "bot"Step 2: Create a new usergroup "searchbots" and set all bot-users as members of this group.
Step 3: in
includes/sessions.php find:
$site_sess = new Session();
and replace it with:
// mod GoogleBot
$site_sess = new Session();
$robots = array(
"FAST-WebCrawler" => "searchbot",
"Gulliver" => "searchbot",
"AltaVista" => "searchbot",
"Alexibot" => "searchbot",
"asterias" => "searchbot",
"BackDoorBot" => "searchbot",
"Black.Hole" => "searchbot",
"BlowFish" => "searchbot",
"BotALot" => "searchbot",
"NPBot" => "searchbot",
"Pompos" => "searchbot",
"Scooter" => "searchbot",
"SiteSnagger" => "searchbot",
"Slurp" => "searchbot",
"WebmasterWorldForumBot" => "searchbot",
"zyborg" => "searchbot",
"Google" => "googlebot",
"msnbot" => "searchbot",
"ZACATEK_CZ_BOT" => "searchbot",
"EARTHCOM.info" => "searchbot",
"sherlock" => "searchbot",
"Holmes" => "searchbot",
"ia_archiver" => "searchbot",
"lwp-trivial" => "searchbot",
"appie" => "searchbot",
"Scooter" => "searchbot",
"Gigabot" => "searchbot",
"Wget" => "searchbot",
"jyxobot" => "searchbot",
"Xenu Link Sleuth" => "searchbot",
"SeznamBot" => "searchbot",
);
foreach($robots as $key => $val) {
if(!$_SERVER['HTTP_USER_AGENT'] || preg_match("/".$key."/i", $_SERVER['HTTP_USER_AGENT'])) {
$site_sess->login($val, "12345");
$user_bot = 1;
break;
}
}
You may add or remove other bots's useragent names as you like or try to put MSIE there for a while, so you may see, how the bot will see the pages... don't forget to delete MSIE from the array aftewards, otherwise ALL your visitors will be logged in as bots
(well, or you could just login as a searchbot
but if you do that and you do hide the userbox for searchbots, you have to delete the cookies, to login back again under your "real" account.)
Step 4.1: If you did not install
Conditional User Group template tags yet, follow the next steps
Open
includes/page_header.php and search for
eachif ($user_info['user_level'] >= USER) {
add the following code
above$usergroups = array();
AND add the following code
below $current_time = time();
$sql = "SELECT group_id
FROM ".GROUP_MATCH_TABLE."
WHERE user_id = ".$user_info['user_id']."
AND groupmatch_startdate <= $current_time
AND (groupmatch_enddate > $current_time OR groupmatch_enddate = 0)";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
$usergroups[$row['group_id']] = true;
}
Step 4.2 search for
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------
and add the following code
above$site_template->register_vars(array(
"is_bot" => (isset($usergroups[XXX])) ? 1 : 0
));
Where XXX has to be replaced with the number of the usergroup. (If you don't know, how to find out the number of the usergroup,
look here)
and from now on you may use this tag:
{if is_bot}
This will appear only for the searchbots...
{endif is_bot}
if you want to hide some parts or disable some functions for the searchbots, install
[MOD] Adding {ifno tagname1}{tagname2}{endifno tagname1} v1.7/v1.7.1 and you will be able to disable
thes parts by
{ifnot is_bot}
This code will not be shown to searchbots
{endifnot is_bot}
On my site bots may browse the pages, but they can't see links to: download, favorities, user-profile, private messages, logout etc.
That should be everything...
Tell me if it works for you - I did not try it out "again" on a fresh install, so I could forget something...