[ABD] Google and phpBB extended... (was [INFO])

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Locked
User avatar
Jaffery
Registered User
Posts: 238
Joined: Sat Oct 18, 2003 2:55 pm
Location: Yaar !!
Contact:

[ABD] Google and phpBB extended... (was [INFO])

Post by Jaffery » Mon Nov 10, 2003 10:34 pm

HI guys .. After lot of reading s post I decieded to go through this complete thread right from the beginning to end. It taken 6 hrs. or my whole night to read the completely.
I found the thread very informative.
http://www.phpbb.com/phpBB/viewtopic.ph ... sc&start=0

But first place it to look http://www.phpbb.com/phpBB/viewtopic.php?p=252424
I m not in the condition to give the details that wht i found or wht I not .but i want give a basic idea to all the the new comer to this thread and also the .. guys who r here right from beginnig...
So.. Starting..

Right in the begining there are two mods (php+google) and (google-enhancement-mode) The first one is used to remove the SIDs for google and google like search engines and the second one is to give google a single session.
From all this thread i found that both the mods work fine untill the version 2.0.3 of phpBB. and the later versions reaquires some changes. So people later to phpBB 2.0.3 should use the following.. instead of #1 google mod.

Code: Select all

#-----[ OPEN  ]------------------------------------------ 
includes/sessions.php 

#-----[ FIND ]------------------------------------------ 
   global $SID; 

if ( !empty($SID) && !preg_match('#sid=#', $url) ) 

#-----[ REPLACE WITH ]------------------------------------------ 
   global $SID, $HTTP_SERVER_VARS; 

   if ( !empty($SID) && !preg_match('sid=', $url) && !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot') && !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'slurp@inktomi.com')) 

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
Also there are several other version of this mod.. but the should be this untill i m writhing this.. I have got this conclusion from the feedback of various other users.
Now in addition to that mod...people should have robots.txt in ther root directory.. (here assumes that u have installed ur forum in root otherwise change the path respective to ur forums path)..

Code: Select all

User-agent: * 
Disallow: /admin/ 
Disallow: /attach_mod/ 
Disallow: /db/ 
Disallow: /files/ 
Disallow: /images/ 
Disallow: /includes/ 
Disallow: /language/ 
Disallow: /mycalendar_mod/ 
Disallow: /spelling/ 
Disallow: /templates/ 
Disallow: /common.php 
Disallow: /config.php 
Disallow: /glance_config.php 
Disallow: /groupcp.php 
Disallow: /memberlist.php 
Disallow: /mini_cal.php 
Disallow: /modcp.php 
Disallow: /mycalendar.php 
Disallow: /news_insert.php 
Disallow: /posting.php 
Disallow: /printview.php 
Disallow: /privmsg.php 
Disallow: /profile.php 
Disallow: /ranks.php 
Disallow: /search.php 
Disallow: /statistics.php 
Disallow: /tellafriend.php 
Disallow: /viewonline.php 
The robots.txt don't let google to spider the unwanted posts..
-------------------------------------------------------------------
During the whole thread there was also a another approach to get rid of SIds for guest and search engines.. That is another mod. But this mods don't work if u allow annonymous user on to post on ur site...

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
#  
includes/sessions.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
$SID = 'sid=' . $session_id; 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
if ( $userdata['session_user_id'] != ANONYMOUS ){ 
   $SID = 'sid=' . $session_id; 
} else { 
   $SID = ''; 
} 
Here also inclusion of the above provided robots.txt is appreciated.

-------------------------------
Below is the mod.. can be used with Mod #1 to get indexed in google faster..
It requires mod_rewrite enabled.. as directed below. (This mod is not in standard form but u can understand it.

Code: Select all

Requirements: you need mod_rewrite enabled as well as ability to use .htaccess or modify apache config files. 

Implementation: 

Step 1. In /includes/page_header.php before 

Code: 
// 
// Generate logged in/logged out status 
// 


add this code (make sure there are no space breaks at line ends after you paste): 

Code: 
ob_start(); 
function replace_for_mod_rewrite(&$s) 
{ 
$urlin = 
array( 
"'(?<!/)viewforum.php\?f=([0-9]*)&topicdays=([0-9]*)&start=([0-9]*)'", 
"'(?<!/)viewforum.php\?f=([0-9]*)&mark=topics'", 
"'(?<!/)viewforum.php\?f=([0-9]*)'", 
"'(?<!/)viewtopic.php\?t=([0-9]*)&view=previous'", 
"'(?<!/)viewtopic.php\?t=([0-9]*)&view=next'", 
"'(?<!/)viewtopic.php\?t=([0-9]*)&postdays=([0-9]*)&postorder=([a-zA-Z]*)&start=([0-9]*)'", 
"'(?<!/)viewtopic.php\?t=([0-9]*)&start=([0-9]*)&postdays=([0-9]*)&postorder=([a-zA-Z]*)&highlight=([a-zA-Z0-9]*)'", 
"'(?<!/)viewtopic.php\?t=([0-9]*)&start=([0-9]*)'", 
"'(?<!/)viewtopic.php\?t=([0-9]*)'", 
"'(?<!/)viewtopic.php&p=([0-9]*)'", 
"'(?<!/)viewtopic.php\?p=([0-9]*)'", 
); 
$urlout = array( 
"viewforum\\1-\\2-\\3.html", 
"forum\\1.html", 
"forum\\1.html", 
"ptopic\\1.html", 
"ntopic\\1.html", 
"ftopic\\1-\\2-\\3-\\4.html", 
"ftopic\\1.html", 
"ftopic\\1-\\2.html", 
"ftopic\\1.html", 
"sutra\\1.html", 
"sutra\\1.html", 
); 
$s = preg_replace($urlin, $urlout, $s); 
return $s; 
} 


Step 2. In /includes/page_tail.php after 

Code: 
$db->sql_close(); 


add this: 

Code: 
$contents = ob_get_contents(); 
ob_end_clean(); 
echo replace_for_mod_rewrite($contents); 
global $dbg_starttime; 
 


in the same file after 

Code: 
ob_end_clean(); 


add this: 

Code: 
echo replace_for_mod_rewrite($contents); 
global $dbg_starttime; 


Step 3. In your .htaccess file (if you don't have one create it; should be located in you forum root directory) paste these lines: 

Code: 
RewriteEngine On 
RewriteRule ^forums.* index.php 
RewriteRule ^forum([0-9]*).* viewforum.php?f=$1&mark=topic 
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* viewforum.php?f=$1&topicdays=$2&start=$3 
RewriteRule ^forum([0-9]*).* viewforum.php?f=$1 
RewriteRule ^ptopic([0-9]*).* viewtopic.php?t=$1&view=previous 
RewriteRule ^ntopic([0-9]*).* viewtopic.php?t=$1&view=next 
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4 
RewriteRule ^ftopic([0-9]*)-([0-9]*).* viewtopic.php?t=$1&start=$2 
RewriteRule ^ftopic([0-9]*).* viewtopic.php?t=$1 
RewriteRule ^ftopic([0-9]*).html viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5 
RewriteRule ^sutra([0-9]*).* viewtopic.php?p=$1 


Note: sometimes this .htaccess code won't work properly if the forum is on a subdomain (was the case with me), you may need to try this variation: 

Code: 
RewriteEngine On 
RewriteRule ^forums.* /index.php 
RewriteRule ^forum([0-9]*).* /viewforum.php?f=$1&mark=topic 
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* /viewforum.php?f=$1&topicdays=$2&start=$3 
RewriteRule ^forum([0-9]*).* /viewforum.php?f=$1 
RewriteRule ^ptopic([0-9]*).* /viewtopic.php?t=$1&view=previous 
RewriteRule ^ntopic([0-9]*).* /viewtopic.php?t=$1&view=next 
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* /viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4 
RewriteRule ^ftopic([0-9]*)-([0-9]*).* /viewtopic.php?t=$1&start=$2 
RewriteRule ^ftopic([0-9]*).* /viewtopic.php?t=$1 
RewriteRule ^ftopic([0-9]*).html /viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5 
RewriteRule ^sutra([0-9]*).* /viewtopic.php?p=$1 


Step 4. Very important! In your robots.txt file (goes at the *site* root) add these lines: 

Code: 
Disallow: /your-forum-folder/sutra*.html$ 
Disallow: /your-forum-folder/ptopic*.html$ 
Disallow: /your-forum-folder/ntopic*.html$ 
Disallow: /your-forum-folder/ftopic*asc*.html$ 


(This is required to avoid feeding duplicate content to Google) 

Step 5. Apply Google Mod #1 described at this page. 

Then there was a suggestion to make a sitemap page having static url to each topic in ur forum generated dynamically. This will allow google to get ur all topics indexed without Sids. But some suggest it is not a good idea for big forums because google don't like more than 200 links on a page. Well the sitemap page u need is below..

Code: Select all

<?php 
/*************************************************************************** 
* Save this file as:   site_map.php (or anything you like) 
* Version:      Friday, Oct 4, 2002 
* Email:      angus@phphacks.com 
* Purpose of hack:   Basically generates a list of topics and 
*      displays them with link to the topic. Goal 
*      is to provide search engines like Google 
*      with a static page of links to dynamic pages 
*      You should link to this page from your sites 
*      home page somewhere. 
* Demo:      http://www.aussiecelebs.com/forums/site_map.php 
* Tested on:   phpBB 2.01, 2.02 
* 
***************************************************************************/ 

/*************************************************************************** 
* 
* This program is free software; you can redistribute it and/or modify 
* it under the terms of the GNU General Public License as published by 
* the Free Software Foundation; either version 2 of the License, or 
* (at your option) any later version. 
* 
***************************************************************************/ 

echo " 

<!-- Start header here. Make sure you dont use any \" s --> 

<html> 
<head> 
<meta http-equiv='Content-Language' content='en-au'> 
<title>Enter Your Title Here</title> 
<meta name='keywords' content='keyword phrase, keyword phrase'> 
<meta name='description' content='Site description including reference to keyword prhase'> 
<base target='_top'> 
</head> 
<body bgcolor='#FFFFFF'> 
<h1>Site Map</h1> 
<!-- End Header --> 

"; 

define('IN_PHPBB', true); 
$phpbb_root_path = './'; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 

echo "<h2>All Categories</h2>"; 

$result = mysql_query("SELECT cat_title, cat_id FROM phpbb_categories ORDER BY cat_title"); 
while($row=  mysql_fetch_assoc($result)) 
{ 
      echo "<a href='index.php?c=".$row["cat_id"]."'>".$row["cat_title"]."</a><br>"; 

} 

echo "<h2>All Forums</h2>"; 

$result = mysql_query("SELECT forum_id, forum_name, forum_desc FROM phpbb_forums ORDER BY forum_name"); 
while($row=  mysql_fetch_assoc($result)) 
{ 
      echo "<a href='viewforum.php?f=".$row["forum_id"]."'>".$row["forum_name"]."</a>"." - ".$row["forum_desc"]."<br>"; 

} 

echo "<h2>All Topics</h2>"; 

$result = mysql_query("SELECT topic_title, topic_id FROM phpbb_topics ORDER BY topic_title"); 
while($row=  mysql_fetch_assoc($result)) 
{ 
      echo "<a href='viewtopic.php?t=".$row["topic_id"]."'>".$row["topic_title"]."</a><br>"; 

} 

echo " 

<!-- Start footer here. --> 

</body> 
</html> 

<!-- End footer --> 

"; 

?> 
Place this page inside ur forum directory and give a link to ur site map in ur mainpage.

In addition to use that .. u can also use dynamic metatage generator by doing the following..

Code: Select all

 includes/page_header.php 
find 
Code: 
define('HEADER_INC', TRUE); 

after, add 
Code: 

// MOD TOPIC META TAGS BEGIN 
// add meta tags - we only want to do this is specifaclly asked 
if( isset($HTTP_GET_VARS['with_meta']) || isset($HTTP_POST_VARS['with_meta']) ) 
{ 
    if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) ) 
    { 
       $topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]); 
    } 
    else if ( isset($HTTP_GET_VARS['topic']) ) 
    { 
       $topic_id = intval($HTTP_GET_VARS['topic']); 
    } 
    
    if ( $topic_id ) 
    { 
        $sql = "SELECT c.cat_title, f.forum_name, t.topic_title 
                FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c 
                WHERE f.forum_id = t.forum_id 
                AND c.cat_id = f.cat_id 
                AND t.topic_id = $topic_id"; 
        if( ($result = $db->sql_query($sql)) ) 
        { 
            if ( $meta_row = $db->sql_fetchrow($result) ) 
            { 
                $meta_description = '<meta name=description content="' . $meta_row['cat_title'] . ' :: ' . $meta_row['forum_name'] . ' :: ' . $meta_row['topic_title'] . '">'; 
            } 
        } 
        $sql = "SELECT w.word_text 
                FROM " . TOPICS_TABLE . " t, " . SEARCH_MATCH_TABLE . " m, " . SEARCH_WORD_TABLE . " w 
                WHERE t.topic_first_post_id = m.post_id 
                AND m.word_id = w.word_id 
                AND t.topic_id = $topic_id"; 
        if( ($result = $db->sql_query($sql)) ) 
        { 
            $meta_keywords = ''; 
            while ( $meta_row = $db->sql_fetchrow($result) ) 
            { 
                $meta_keywords .= ($meta_keywords=='') ? $meta_row['word_text'] : ',' . $meta_row['word_text']; 
            } 
            $meta_keywords = '<meta name=keywords content="' . $meta_keywords . '">'; 
        }    
    } 
} 
// MOD TOPIC META TAGS END 
 


find 
Code: 
'PAGE_TITLE' => $page_title, 

after, add 
Code: 

    'META_DESCRIPTION' => $meta_description, 
    'META_KEYWORDS' => $meta_keywords, 
 


in templates/subSilver/overall_header.tpl 
find 
Code: 
<meta http-equiv="Content-Style-Type" content="text/css"> 

after, add 
Code: 

{META_DESCRIPTION} 
{META_KEYWORDS} 
 


then all you need to do in your sitemap page is add... 
Code: 
&with_meta= 


Also there are few more mods and they are good. but the above i have mention turns out to be the successfull and checked by various users feedback.


I found that there are basically 4 techniques developed in this thread. 3 as mod and one as creating a site map. so it will be nice the topic is splitted into 4 for or less parts starting freshly. I found this request various time in between the thread. Also these thread is so confusing as it is big. I decieded to read at once due to its large size.

Also I am very-very thankful to those who had worked a lot to provide varoious mods in this thread.

Also this thread provided some good link to various SEO related tools..
I only remember one posted by me earlier.. www.free-seo-tools.com

And at the end i apologize for my bad english .. also forgive me if i have done any mistake in giving the my view wht I got after reading the whole thread. If some thing is missing then please mention that .. i ll try to implement.
Last edited by Jaffery on Mon Jan 05, 2004 2:40 pm, edited 3 times in total.
Free fast Image Hosting at www.ImageTor.com | Linux Forum <--- LinuxSolved.com
Bodybuilding <--- Bodybuilding.name Forums
Shayari <---- Poetry Forum at Yoindia.com
Linux webhosting <---- Linux Webhosting at MGCyber.net

User avatar
Jaffery
Registered User
Posts: 238
Joined: Sat Oct 18, 2003 2:55 pm
Location: Yaar !!
Contact:

Post by Jaffery » Thu Nov 13, 2003 6:57 am

If anybody got stucked in using the anymod above or have any problem in any of the above mod.. ask here.
And also suggestion for new mod for seach engine optimization..
Free fast Image Hosting at www.ImageTor.com | Linux Forum <--- LinuxSolved.com
Bodybuilding <--- Bodybuilding.name Forums
Shayari <---- Poetry Forum at Yoindia.com
Linux webhosting <---- Linux Webhosting at MGCyber.net

User avatar
Jaffery
Registered User
Posts: 238
Joined: Sat Oct 18, 2003 2:55 pm
Location: Yaar !!
Contact:

Post by Jaffery » Fri Nov 14, 2003 1:51 pm

Edited.....
Last edited by Jaffery on Mon Jan 05, 2004 2:05 pm, edited 1 time in total.
Free fast Image Hosting at www.ImageTor.com | Linux Forum <--- LinuxSolved.com
Bodybuilding <--- Bodybuilding.name Forums
Shayari <---- Poetry Forum at Yoindia.com
Linux webhosting <---- Linux Webhosting at MGCyber.net

bradleyk
Registered User
Posts: 5
Joined: Sat Nov 15, 2003 11:16 am

Better way to check for spider agents

Post by bradleyk » Sat Nov 15, 2003 11:25 am

This is a slight modification from a similar function used by osCommerce:

Code: Select all

#-----[ OPEN  ]------------------------------------------ 
includes/sessions.php 

#-----[ FIND ]------------------------------------------ 
function append_sid($url, $non_html_amp = false)

#-----[ INSERT BEFORE ]------------------------------------------ 
function tep_not_null($value) {
    if (is_array($value)) {
      if (sizeof($value) > 0) {
        return true;
      } else {
        return false;
      }
    } else {
      if (($value != '') && (strtolower($value) != 'null') &&       (strlen(trim($value)) > 0)){
        return true;
      } else {
        return false;
      }
    }
}

#-----[ FIND ]------------------------------------------ 
   global $SID; 

if ( !empty($SID) && !preg_match('#sid=#', $url) ) 

#-----[ REPLACE WITH ]------------------------------------------ 
    $user_agent = strtolower($HTTP_SERVER_VARS['HTTP_USER_AGENT']);
    $spider_flag = false;

    if (tep_not_null($user_agent)) {
      $spiders = file($phpbb_root_path . 'includes/spiders.txt');

      for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {
        if (tep_not_null($spiders[$i])) {
          if (is_integer(strpos($user_agent, trim($spiders[$i])))) {
            $spider_flag = true;
            break;
          }
        }
      }
    }


        if ( !empty($SID) && !eregi('sid=', $url) &&
             !($spider_flag))

#-----[ CREATE]------------------------------------------ 
includes/spiders.txt

#-----[ INSERT ]------------------------------------------ 
almaden.ibm.com
appie 1.1
architext
ask jeeves
asterias2.0
augurfind
baiduspider
bannana_bot
bdcindexer
crawler
crawler@fast
docomo
fast-webcrawler
fluffy the spider
frooglebot
geobot
googlebot
gulliver
henrythemiragorobot
ia_archiver
infoseek
kit_fireball
lachesis
lycos_spider
mantraagent
mercator
moget/1.0
muscatferret
nationaldirectory-webspider
naverrobot
ncsa beta
netresearchserver
ng/1.0
osis-project
polybot
pompos
scooter
seventwentyfour
sidewinder
sleek spider
slurp/si
slurp@inktomi.com
steeler/1.3
szukacz
t-h-u-n-d-e-r-s-t-o-n-e
teoma
turnitinbot
ultraseek
vagabondo
voilabot
w3c_validator
zao/0
zyborg/1.0
 
This should now compare the incoming agent against a list of known agents in a case insensitive way. Plus, its a heck of a lot easier to now edit the agent's your looking for. It seems to work well on my site.

User avatar
Jaffery
Registered User
Posts: 238
Joined: Sat Oct 18, 2003 2:55 pm
Location: Yaar !!
Contact:

Post by Jaffery » Sun Nov 16, 2003 10:15 am

Will that work in phpBB 2.0.6 ??
Free fast Image Hosting at www.ImageTor.com | Linux Forum <--- LinuxSolved.com
Bodybuilding <--- Bodybuilding.name Forums
Shayari <---- Poetry Forum at Yoindia.com
Linux webhosting <---- Linux Webhosting at MGCyber.net

bradleyk
Registered User
Posts: 5
Joined: Sat Nov 15, 2003 11:16 am

Post by bradleyk » Mon Nov 17, 2003 8:37 pm

Yeah, that's what I'm using it in. I actually realized one slight bug in the posted code. Because I'm using $phpbb_root_path . 'includes/spiders.txt' as the path for the filename, it complains when I try to go to the admin panel.

<hack>One way to fix this is to just make an admin/includes/spiders.txt file.</hack>

A better way would be to figure out how to use the correct path variable.

I haven't done any phpBB development other than the above code, and don't really have time to dig in to find the correct variable. If someone could let me know what that is, I'd be happy to update the code, and post the latest greatest version in the contributions section.

User avatar
Jaffery
Registered User
Posts: 238
Joined: Sat Oct 18, 2003 2:55 pm
Location: Yaar !!
Contact:

Post by Jaffery » Wed Nov 19, 2003 6:08 am

Well..
I have tried all the above search mod.. on my forum .. and found the one below best as soon as u r not having guest post on..

Code: Select all

#
#-----[ OPEN ]------------------------------------------
# 
includes/sessions.php

#
#-----[ FIND ]------------------------------------------
#
$SID = 'sid=' . $session_id;

#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $userdata['session_user_id'] != ANONYMOUS ){
   $SID = 'sid=' . $session_id;
} else {
   $SID = '';
} 
I am also using that on my forum..
Free fast Image Hosting at www.ImageTor.com | Linux Forum <--- LinuxSolved.com
Bodybuilding <--- Bodybuilding.name Forums
Shayari <---- Poetry Forum at Yoindia.com
Linux webhosting <---- Linux Webhosting at MGCyber.net

bradleyk
Registered User
Posts: 5
Joined: Sat Nov 15, 2003 11:16 am

Post by bradleyk » Wed Nov 19, 2003 7:27 am

Good fix. I like that one better...

Here's a good analyzer to test if your site is working. It allows you to pretend you are multiple different spiders while looking at the site.

http://www.submitexpress.com/analyzer/

Good for debugging. The info you'll want to look at is at the bottom of the page.

User avatar
Jaffery
Registered User
Posts: 238
Joined: Sat Oct 18, 2003 2:55 pm
Location: Yaar !!
Contact:

Post by Jaffery » Wed Nov 19, 2003 1:55 pm

That was a good link..
Free fast Image Hosting at www.ImageTor.com | Linux Forum <--- LinuxSolved.com
Bodybuilding <--- Bodybuilding.name Forums
Shayari <---- Poetry Forum at Yoindia.com
Linux webhosting <---- Linux Webhosting at MGCyber.net

CMS Music
Registered User
Posts: 4
Joined: Sat Nov 15, 2003 5:55 am
Contact:

Post by CMS Music » Fri Nov 21, 2003 11:10 am

and where exactly in the site map page are you supposed to put

Code: Select all

&with_meta= 
I'm new to this, please help.

kolczyk
Registered User
Posts: 73
Joined: Sat Dec 14, 2002 8:57 pm

Post by kolczyk » Fri Nov 21, 2003 5:14 pm

haha!
it's working!

-----
10 thousands pages crawlered!
forum with installed addon:
http://www.google.pl/search?q=allinurl: ... 8&filter=0
almost 10 thousands pages! :)

----

forum without installed addon:
http://www.google.pl/search?q=allinurl: ... 8&filter=0
only 4,500 spidered from two years (most of them are profiles) :(
-----

problem is with sid, when user is login in and he has disabled cookies, so links looks like:
http://www.elektroda.pl/eboard/forum67. ... ee5631833c
and of course this is not working when he click somewhere - he is automatic login out :(
and of course non anonymous posting and all links with sid are not working

kwnah
Registered User
Posts: 88
Joined: Fri Oct 24, 2003 2:16 pm
Contact:

Post by kwnah » Fri Nov 21, 2003 5:22 pm

me new as well.

My link is http://www.metrica-tech.com/forum

rbester
Registered User
Posts: 1
Joined: Fri Nov 21, 2003 5:08 pm

Post by rbester » Fri Nov 21, 2003 5:22 pm

Hi you all!

I apperciate you Webmasters helping each other so hopefully I can contribute something as well..

I used bradleyk first mod for "people later to phpBB 2.0.3" but in order to add more spiders instead of using an external spiders.txt as suggested later on I am using an internal function that has an array of spiders (all in lower case letters) - which works fine. Here is the code that works for me:

Code: Select all

#-----[ OPEN  ]------------------------------------------ 
includes/sessions.php 

#-----[ FIND ]------------------------------------------ 
global $SID; 

if ( !empty($SID) && !preg_match('#sid=#', $url) ) 

#-----[ REPLACE WITH ]------------------------------------------ 
	global $SID, $HTTP_SERVER_VARS; 

	if (	!empty($SID) && 
		!preg_match('sid=', $url) &&
		!checkRobots($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) 

#-----[ FIND ]------------------------------------------ 
function append_sid($url, $non_html_amp = false) 

#-----[ INSERT BEFORE ]------------------------------------------ 
//
// check whether the user agent is a robot and retrun true if it is
// otherwise return false
//
function checkRobots($usrAgent)
{
	$uAgant = strtolower($usrAgent);

	//
	// robots array all in lower case (feel free to add more robots)
	//
	$seRobots = array(
		'almaden.ibm.com',
		'ask jeeves',
		'crawler@fast',
		'fast-webcrawler',
		'googlebot',
		'scooter',
		'slurp',
		'szukacz',
		'msnbot',
		't-h-u-n-d-e-r-s-t-o-n-e',
		'teoma',
		'zyborg'
	);

	while (list($key, $value) = each($seRobots)) {
		if (strstr($uAgant,$value))
			return true;
	}
	return false;
}

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM

kwnah
Registered User
Posts: 88
Joined: Fri Oct 24, 2003 2:16 pm
Contact:

Post by kwnah » Fri Nov 21, 2003 5:57 pm

ok,...i amend the session.php, i use the site_map.php

how long shall i wait in order to see the result ?

kwnah
Registered User
Posts: 88
Joined: Fri Oct 24, 2003 2:16 pm
Contact:

Post by kwnah » Fri Nov 21, 2003 6:14 pm

When i first login, got error ,,,...and now when I try to go to Admin Panel, it has the below error
Warning: Delimiter must not be alphanumeric or backslash in /usr/local/xxxxxx/httpdocs/forum/includes/sessions.php on line 423

Warning: Delimiter must not be alphanumeric or backslash in /usr/localxxxxxxxx/httpdocs/forum/includes/sessions.php on line 423

Warning: Delimiter must not be alphanumeric or backslash in /usr/local/xxxxxxxx/httpdocs/forum/includes/sessions.php on line 423

Warning: Delimiter must not be alphanumeric or backslash in /usr/local/psa/home/xxxxxxxx/httpdocs/forum/includes/sessions.php on line 423

Warning: Delimiter must not be alphanumeric or backslash in /usr/local/psa/home/xxxxxxhttpdocs/forum/includes/sessions.php on line 423

Warning: Delimiter must not be alphanumeric or backslash in /usr/local/psa/home/xxxxxxxhttpdocs/forum/includes/sessions.php on line 423

Warning: Cannot add header information - headers already sent by (output started at /usr/xxxxxxxx/httpdocs/forum/includes/sessions.php:423) in /usr/local/psa/xxxxxxxhttpdocs/forum/admin/index.php on line 582

Warning: Cannot add header information - headers already sent by (output started at /usr/local/xxxxx/httpdocs/forum/includes/sessions.php:423) in /usr/local/Xxxx/httpdocs/forum/admin/index.php on line 583

Warning: Delimiter must not be alphanumeric or backslash in /usr/local/xxxxxxx/httpdocs/forum/includes/sessions.php on line 423


sessions.php line 423 is

Code: Select all

	global $SID, $HTTP_SERVER_VARS; 

   	if (   !empty($SID) && 
Line 423 <---      		!preg_match('sid=', $url) && 
      		!checkRobots($HTTP_SERVER_VARS['HTTP_USER_AGENT']))
	{
		$url .= ( ( strpos($url, '?') != false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
	}

	return $url;
another error in the admin/index.php is the line 582, 583

Code: Select all

	header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
	header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Last edited by kwnah on Sat Nov 22, 2003 4:19 pm, edited 2 times in total.

Locked

Return to “[2.0.x] MODs in Development”