Custom Who.template.php - separated list for users, guests and spiders

Started by Owdy, November 03, 2004, 01:15:56 PM

Previous topic - Next topic

Niteblade

Out of curiousity --

Has anyone updated and added to the list of spiders and bots inside this file ?

Would it be possible for you to make it available ?

Thanks !
affiliate blog

RBH

recently i have had a swarm of snapbots visiting my site. they are showing as guests so i tried adding them to the who.template as instructed in the first post but they still show as guests. here is what i added to template.

array (

'agent' => 'Snapbot/1.0',

'spidername' => 'Snapbot',

'spider' => true,

),


any ideas on how to get these guys to show up with thier name other then guest?

Assistance

Quote from: nite0859 on July 16, 2006, 09:50:52 PM
Out of curiousity --

Has anyone updated and added to the list of spiders and bots inside this file ?

Would it be possible for you to make it available ?

anyone willing to share?
~playing poker~

Sourcecode

there's so much I felt but I can't explain
the urge of love remains, but all these easy faces change
still so much I feel but still I can't explain
am I the one to blame
I can't hold a face without a name nomore
it's up to me to... take me home tonight


Contact Info :
E-Mail : sourcecode [AT] replica-solutions [DOT] de
As I kissed her goodbye, I said, 'All beauty must die'

Fly like an Eagle, or Scratch with the Chicken!


iettafune


xenovanis

"Insanity: doing the same thing over and over again and expecting different results."

iettafune

when i install it in my rc3 i received this error:

Install Actions
Installations actions for "Googlebot & Spiders Mod":
The package you are trying to download or install is either corrupt or not compatible with this version of SMF. 

iettafune


RebelRose

I am getting these error's now and I never got theme before, not sure what is going on, any idea's?


8: Undefined index: who_action
File: /forum/Themes/TP_DilberMC/Who.template.php (eval?)
Line: 81


8: Undefined index: who_time
File: /forum/Themes/TP_DilberMC/Who.template.php (eval?)
Line: 79


8: Undefined index: who_user
File: /forum/Themes/TP_DilberMC/Who.template.php (eval?)
Line: 77


King RoRo

thanks alot bro for ur trick its so powerfull

im working on rc3
but in the file b4 the final one

mobiles visitors was appears with the mobile model like (nokia 6630 for ex.)
now the brand only appears without the model ....

do u have a solution for that plz?
www.KingRoRo.com/smf
Best Syrian-Homsy Forum

Sarlat

It should be nice to localize the file !

In the Who.template.php
Code (find) Select
<div style="padding: 3px;">', theme_linktree(), '</div>';
$brokendown = array (
'Members' => array(),
'Guests' => array(),
'Spiders' => array(),
);

Code (replace) Select
<div style="padding: 3px;">', theme_linktree(), '</div>';
$brokendown = array (
$txt['users'] => array(),
$txt['guests'] => array(),
$txt['spiders'] => array(),
);


And in /Themes/default/languages/Who.<language>.php
Code (add) Select
$txt['spiders'] = 'Spiders';

Sarlat

Quote from: Owdy on September 10, 2006, 01:11:59 PM
Have you tested that?  I think that wont work. Look translation instructions in first post ;)
Of course I have tested it !
It's actually working on 1.08 and RC3.

jeremyyeo

Hey guys, I have the show member legend mod installed. I bet that modded the who.template.php file so im asking how do I add this custom template without deleting the effect of the member legend mod? thanks. ;)

Vinspire

Quote from: Sourcecode on August 22, 2006, 06:05:32 PM
Works Perfect with SMF1.1RC3 also.

I only need to replace the Who.template.php file in #1 post onto the RC3 file ?


FinsandFur

Owdy,
I seem to be having a little trouble getting the spiders to show up in Who's Online.
I uploaded your file to my themes directory, which by the way is called index.php when it's downloaded, not who.template.php

I removed he old index.php and replaced it with your file.
I see spiders out front in "Users Online", but when I go to "Who's online" it shows them as guests.

Any idea what I may have done wrong?

Much appreciated .  ;D

FinsandFur

Guess what ....

It worked!

My apologies. I thought when you said upload to themes dir and enjoy, that's literally what you wanted done.
But in reality it needed to be renamed to Who.template, and replace the one in the default dir.

Works beautifully, and I thank ya much Not only for a great modification but for a speedy reply.

Pedja

I changed a bit this Who.template.php to show USer Agent inforamtion about users. This shows only to admins. It is useful when you are looking for unknown spiders.

I have no option to upload attachment here so I have to post file as code. Just save it under name Who.template.php an replace existing one on forum.




<?php



// The only template in the file.

function template_main()

{

global $context$settings$options$scripturl$txt;

// Display the table header and linktree.

echo '

<div style="padding: 3px;">'
theme_linktree(), '</div>';

$brokendown = array (

'Members' => array(),

'Guests' => array(),

'Spiders' => array(),

);



foreach($context['members'] AS $key => $member)

{

$spider getAgent($member['query']['USER_AGENT'], $context['members'][$key]['name'], $agent$member['id'] == 0);

$context['members'][$key]['agent'] = $agent;

$member['query']['USER_AGENT'] = isset($member['query']['USER_AGENT']) ? $member['query']['USER_AGENT'] : '';

if ( $member['id'] != )

$brokendown['Members'][] = &$context['members'][$key];

else if ( $spider )

$brokendown['Spiders'][] = &$context['members'][$key];

else

$brokendown['Guests'][] = &$context['members'][$key];

}

// echo '<pre>'; print_r($brokendown['Spiders']); echo '</pre>'; return;

foreach($brokendown AS $group => $members)

{

echo '

<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">

<tr>

<td class="catbg">'
$group'</td>

</tr>

</table>

<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">

<tr class="titlebg">

<td width="30%"><a href="' 
$scripturl '?action=who;sort=user'$context['sort_direction'] == 'down' && $context['sort_by'] == 'user' ';asc' '''">'$txt['who_user'], ' '$context['sort_by'] == 'user' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></td>

<td style="width: 14ex;"><a href="' 
$scripturl '?action=who;sort=time'$context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ';asc' '''">'$txt['who_time'], ' '$context['sort_by'] == 'time' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></td>

<td>'
$txt['who_action'], '</td>

</tr>'
;



// This is used to alternate the color of the background.

$alternate true;



// For every member display their name, time and action (and more for admin).

foreach ($members as $member)

{



// $alternate will either be true or false.  If it's true, use "windowbg2" and otherwise use "windowbg".

echo '

<tr class="windowbg'
$alternate '2' '''">

<td>'
;



// Guests don't have information like icq, msn, y!, and aim... and they can't be messaged.

if (!$member['is_guest'])

{

echo '

<div style="float: right; width: 14ex;">

'
$context['can_send_pm'] ? '<a href="' $member['online']['href'] . '" title="' $member['online']['label'] . '">' ''$settings['use_image_buttons'] ? '<img src="' $member['online']['image_href'] . '" alt="' $member['online']['text'] . '" border="0" align="middle" />' $member['online']['text'], $context['can_send_pm'] ? '</a>' '''

'
$member['icq']['link'], ' '$member['msn']['link'], ' '$member['yim']['link'], ' '$member['aim']['link'], '

</div>'
;

}



echo '

<span'
$member['is_hidden'] ? ' style="font-style: italic;"' '''>'$member['is_guest'] ? $member['name'] : '<a href="' $member['href'] . '" title="' $txt[92] . ' ' $member['name'] . '"' . (empty($member['color']) ? '' ' style="color: ' $member['color'] . '"') . '>' $member['name'] . '</a>''</span>';

echo '

</td>

<td nowrap="nowrap">'
$member['time'], '</td>

<td>'
$member['action'], '</td>

</tr>'
;
   if ( !empty($member['ip']) ) {
                echo 
'<tr class="windowbg'$alternate '2' '''"><td colspan="3">';
    
echo '<span class="smalltext">';

//                 if ($context['user']['is_admin']) {


echo '(<b><a href="' $scripturl '?action=trackip;searchip=' $member['ip'] . '" target="_blank" title="' $member['ip'] . '" class="smalltext2">' $member['ip'] . '</a></b>, <acronym title="' $member['query']['USER_AGENT'] . '">' $member['agent'] . '</acronym>)';
//                   }
      
   echo ' User agent: ' $member['query']['USER_AGENT']; 

                echo 
'</span>';
                echo 
'</td></tr>';

                 }

// Switch alternate to whatever it wasn't this time. (true -> false -> true -> false, etc.)

$alternate = !$alternate;

}

echo '</table><br/>';

}

echo '

<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder"><tr><td class="titlebg">

<b>'
$txt[139], ':</b> '$context['page_index'], '

</td></tr></table>'
;



}



function 
getAgent( &$user_agent, &$user_name, &$result$guest )

{

$known_agents = array (

                
//Search Spiders

array (

'agent' => 'WISENutbot',

'spidername' => 'Looksmart spider',

                        
'spider' => true,

),

array (

'agent' => 'MSNBot',

'spidername' => 'MSN spider',

'spider' => true,

),

array (

'agent' => 'W3C_Validator',

'spidername' => 'W3C Validaator',

        'spider' => true,

),

array (

'agent' => 'Googlebot-Image',

'spidername' => 'Google-Image Spider',

'spider' => true,

),

array (

'agent' => 'Googlebot',

'spidername' => 'Google spider',

'spider' => true,

),



array (

'agent' => 'Mediapartners-Google',

'spidername' => 'Google AdSense spider',

'spider' => true,

),



                array (

'agent' => 'Openbot',

'spidername' => 'Openfind spider',

'spider' => true,

                ),

array (

'agent' => 'Yahoo! Slurp',

'spidername' => 'Yahoo spider',

'spider' => true,
),



                array (

'agent' => 'FAST-WebCrawler',

'spider' => true,

                ),

                array (

'agent' => 'Wget',

'spider' => true,

                ),

array (

'agent' => 'Ask Jeeves'

'spider' => true,



),

array (

'agent' => 'Speedy Spider',

'spider' => true,



),

array (

'agent' => 'SurveyBot',

'spider' => true,



),

array (

'agent' => 'IBM_Planetwide',

'spider' => true,



),



                array (

'agent' => 'GigaBot',

'spider' => true,



),

array (

'agent' => 'ia_archiver',

'spider' => true,

),

array (

'agent' => 'FAST-WebCrawler',

'spider' => true,



),

array (

'agent' => 'Inktomi Slurp',

                        
'spider' => true,

),

                

                array (

'agent' => 'appie',

'spidername' => 'Walhello spider',

'spider' => true,

),

                array (

'agent' => 'Pogodak.co.yu',

'spidername' => 'Pogodak',

'spider' => true,

),

                array (

'agent' => 'TridentSpider',

'spider' => true,

),

 //mobiles

 array (
'agent' => 'Nokia'
 ),
 array (
'agent' => 'Samsung',
 ),
 array (
'agent' => 'Ericsson',
 ),
array (
'agent' => 'Siemens',
 ),
  array (
'agent' => 'Motorola',
),
                
//Browsers

 
array (

'agent' => 'Opera',

),

array (

'agent' => 'Firefox',

),

array (

'agent' => 'Firebird',

),

array (

'agent' => 'Safari'

),

           
array (

'agent' => 'Netscape',

),

array (

'agent' => 'MyIE2'

),

array (

'agent' => 'Konqueror'

),

array (

'agent' => 'Galeon'

),

array (

'agent' => 'KMeleon',

),

                array (

'agent' => 'NG/2.0',

),



                array (

'agent' => 'Gecko',

'name' => 'Mozilla',

         
),

                array (

'agent' => 'MSIE',



                ),

);



foreach( 
$known_agents AS $poss )

if (strpos(strtolower($user_agent), strtolower($poss['agent'])) !== false)

{

if ( $guest && isset($poss['spider']) && $poss['spider'] )

$user_name = isset($poss['spidername']) ? $poss['spidername'] : (isset($poss['name']) ? $poss['name'] : $poss['agent']); 

$result = isset($poss['name']) ? $poss['name'] : $poss['agent']; 

return isset($poss['spider']) && $poss['spider'];

}

$result $user_agent;

return false;

}



?>





RebelRose


Advertisement: