News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

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

teamvtec

I have 2 pages full with this error >:( :

2: Division by zero
File: /home/teamvtec/domains/sirfanaticsholland.com/public_html/forum/Themes/default/languages/Who.english.php (eval?)
Line: 302

Can't seem to find anything wrong on that line, help please

nitins60

The attachment in first post Who.template.php is giving template parser error!

nitins60



teamvtec

Quote from: teamvtec on January 26, 2007, 07:44:48 PM
I have 2 pages full with this error >:( :

2: Division by zero
File: /home/teamvtec/domains/sirfanaticsholland.com/public_html/forum/Themes/default/languages/Who.english.php (eval?)
Line: 302

Can't seem to find anything wrong on that line, help please

Still having this problem

navjotjsingh

Don't use the code from first post. Use this code: http://www.simplemachines.org/community/index.php?topic=19243.msg762733#msg762733

It works wonderfully with GoogleBot Spiders Mod 2.0.2, TP 0.97.1 and SMF 1.1.1

teamvtec

Thanks for your replies, the post of navjotjsingh did the trick, guess there was an error somewhere... anyways it's gone now ;D

@ Owdy I couldn't replace the Who.english.php with a fresh one from the orginal smf package because i have more mods installed that affect this Who page.
Thanks anyway ;)

mark7144

Still no clever clogs figured out how to display all the members first then the guest after?

کíŋ

I'm trying to include a query under the user agent info (added by Pedja) that returns Members from IP (range) results all in the one Who.template.php

Useful to see at a glance if any of the ip's have multiple ID's and may marry up some guest IP's in the process.

The query for Members from IP (range) is drawn from the Profile.php in the sources directory and so far I haven't found any SSI statements as an alternative.

Anyone willing to give this one a hack?

کíŋ

frost4225

sorry i did the install and everything went fine and it added a new who.template to my themes folder but am i suppose to use the who.template because when i do there is no pictures or anything like it doesn't know where to look.

i am attaching an image


frost4225


Zenigata

Hi,
how can I display the version of the browser? For example IE 6.0, Ie 7.0, Firefox 2.0, thanks.

Pedja

Quote from: کíŋ on February 03, 2007, 10:47:28 PM
I'm trying to include a query under the user agent info (added by Pedja) that returns Members from IP (range) results all in the one Who.template.php

I've done this. As I have no option to upload atachmets I am posting source into message. It will ad new column to Whois which wil show IP address and allow list to be sorted by that column. Records are sorted within Memebrs, Guests and Spiders groups separately.

These are updated versions of altered scripts I already posted. It may contain some more spiders too.

Who.php - goes to Sources

<?php
/******************************************************************************
* Who.php                                                                     *
*******************************************************************************
* SMF: Simple Machines Forum                                                  *
* Open-Source Project Inspired by Zef Hemel ([email protected])                *
* =========================================================================== *
* Software Version:           SMF 1.1 RC3                                     *
* Software by:                Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2006 by:     Lewis Media (http://www.lewismedia.com)         *
* Support, News, Updates at:  http://www.simplemachines.org                   *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it     *
* under the terms of the provided license as published by Lewis Media.        *
*                                                                             *
* This program is distributed in the hope that it is and will be useful,      *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
* See the "license.txt" file for details of the Simple Machines license.      *
* The latest version can always be found at http://www.simplemachines.org.    *
******************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');

/* This file is mainly concerned, or that is to say only concerned, with the
Who's Online list.  It contains only the following functions:

void Who()
- prepares the who's online data for the Who template.
- uses the Who template (main sub template.) and language file.
- requires the who_view permission.
- is enabled with the who_enabled setting.
- is accessed via ?action=who.

array determineActions(array urls)
- determine the actions of the members passed in urls.
- urls should be a single url (string) or an array of arrays, each
  inner array being (serialized request data, ID_MEMBER).
    - returns an array of descriptions if you passed an array, otherwise
  the string describing their current location.

Adding actions to the Who's Online list:
---------------------------------------------------------------------------
Adding actions to this list is actually relatively easy....
 - for actions anyone should be able to see, just add a string named
   whoall_ACTION.  (where ACTION is the action used in index.php.)
 - for actions that have a subaction which should be represented
   differently, use whoall_ACTION_SUBACTION.
 - for actions that include a topic, and should be restricted, use
   whotopic_ACTION.
 - for actions that use a message, by msg or quote, use whopost_ACTION.
 - for administrator-only actions, use whoadmin_ACTION.
 - for actions that should be viewable only with certain permissions,
   use whoallow_ACTION and add a list of possible permissions to the
   $allowedActions array, using ACTION as the key.
*/

// Who's online, and what are they doing?
function Who()
{
global $db_prefix$context$scripturl$user_info$txt$modSettings$ID_MEMBER$memberContext;

// Permissions, permissions, permissions.
isAllowedTo('who_view');

// You can't do anything if this is off.
if (empty($modSettings['who_enabled']))
fatal_lang_error('who_off'false);

// Load the 'Who' template.
loadTemplate('Who');

// Sort out... the column sorting.
$sort_methods = array(
'user' => 'mem.realName',
'time' => 'lo.logTime',
'ip' => 'lo.ip'
);

// By default order by last time online.
if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
{
$context['sort_by'] = 'time';
$_REQUEST['sort'] = 'lo.logTime';
}
// Otherwise default to ascending.
else
{
$context['sort_by'] = $_REQUEST['sort'];
$_REQUEST['sort'] = $sort_methods[$_REQUEST['sort']];
}

$context['sort_direction'] = isset($_REQUEST['asc']) ? 'up' 'down';

// Get the total amount of members online.
$request db_query("
SELECT COUNT(*)
FROM 
{$db_prefix}log_online AS lo
LEFT JOIN 
{$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID_MEMBER)" . (!allowedTo('moderate_forum') ? "
WHERE IFNULL(mem.showOnline, 1) = 1" 
''), __FILE____LINE__);
list ($totalMembers) = mysql_fetch_row($request);
mysql_free_result($request);

// Prepare some page index variables.
$context['page_index'] = constructPageIndex($scripturl '?action=who;sort=' $context['sort_by'] . (isset($_REQUEST['asc']) ? ';asc' ''), $_REQUEST['start'], $totalMembers$modSettings['defaultMaxMembers']);
$context['start'] = $_REQUEST['start'];

// Look for people online, provided they don't mind if you see they are.
$request db_query("
SELECT
(UNIX_TIMESTAMP(lo.logTime) - UNIX_TIMESTAMP() + " 
time() . ") AS logTime,
lo.ID_MEMBER, lo.url, INET_NTOA(lo.ip) AS ip, mem.realName, lo.session,
mg.onlineColor, IFNULL(mem.showOnline, 1) AS showOnline
FROM 
{$db_prefix}log_online AS lo
LEFT JOIN 
{$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN 
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))" . (!allowedTo('moderate_forum') ? "
WHERE IFNULL(mem.showOnline, 1) = 1" 
'') . "
ORDER BY 
$_REQUEST[sort] " . (isset($_REQUEST['asc']) ? 'ASC' 'DESC') . "
LIMIT 
$context[start]$modSettings[defaultMaxMembers]"__FILE____LINE__);
$context['members'] = array();
$member_ids = array();
$url_data = array();
while ($row mysql_fetch_assoc($request))
{
$actions = @unserialize($row['url']);
if ($actions === false)
continue;

// Send the information to the template.
$context['members'][$row['session']] = array(
'id' => $row['ID_MEMBER'],
'ip' => allowedTo('moderate_forum') ? $row['ip'] : '',
// It is *going* to be today or yesterday, so why keep that information in there?
'time' => strtr(timeformat($row['logTime']), array($txt['smf10'] => ''$txt['smf10b'] => '')),
'timestamp' => forum_time(true$row['logTime']),
'query' => $actions,
'is_hidden' => $row['showOnline'] == 0,
'color' => empty($row['onlineColor']) ? '' $row['onlineColor']
);

$url_data[$row['session']] = array($row['url'], $row['ID_MEMBER']);
$member_ids[] = $row['ID_MEMBER'];
}
mysql_free_result($request);

// Load the user data for these members.
loadMemberData($member_ids);

// Load up the guest user.
$memberContext[0] = array(
'id' => 0,
'name' => $txt[28],
'group' => $txt[28],
'href' => '',
'link' => $txt[28],
'email' => $txt[28],
'is_guest' => true
);

$url_data determineActions($url_data);

// Setup the linktree and page title (do it down here because the language files are now loaded..)
$context['page_title'] = $txt['who_title'];
$context['linktree'][] = array(
'url' => $scripturl '?action=who',
'name' => $txt['who_title']
);

// Put it in the context variables.
foreach ($context['members'] as $i => $member)
{
if ($member['id'] != 0)
$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;

// Keep the IP that came from the database.
$memberContext[$member['id']]['ip'] = $member['ip'];
$context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : $txt['who_hidden'];
$context['members'][$i] += $memberContext[$member['id']];
}

// Some people can't send personal messages...
$context['can_send_pm'] = allowedTo('pm_send');
}

function 
determineActions($urls)
{
global $txt$db_prefix$user_info$ID_MEMBER$modSettings;

if (!allowedTo('who_view'))
return array();
loadLanguage('Who');

// Actions that require a specific permission level.
$allowedActions = array(
'admin' => array('moderate_forum''manage_membergroups''manage_bans''admin_forum''manage_permissions''send_mail''manage_attachments''manage_smileys''manage_boards''edit_news'),
'ban' => array('manage_bans'),
'boardrecount' => array('admin_forum'),
'calendar' => array('calendar_view'),
'editnews' => array('edit_news'),
'mailing' => array('send_mail'),
'maintain' => array('admin_forum'),
'manageattachments' => array('manage_attachments'),
'manageboards' => array('manage_boards'),
'mlist' => array('view_mlist'),
'optimizetables' => array('admin_forum'),
'repairboards' => array('admin_forum'),
'search' => array('search_posts'),
'search2' => array('search_posts'),
'setcensor' => array('moderate_forum'),
'setreserve' => array('moderate_forum'),
'stats' => array('view_stats'),
'viewErrorLog' => array('admin_forum'),
'viewmembers' => array('moderate_forum'),
);

if (!is_array($urls))
$url_list = array(array($urls$ID_MEMBER));
else
$url_list $urls;

// These are done to later query these in large chunks. (instead of one by one.)
$topic_ids = array();
$profile_ids = array();
$board_ids = array();

$data = array();
foreach ($url_list as $k => $url)
{
// Get the request parameters..
$actions = @unserialize($url[0]);
if ($actions === false)
continue;

// Check if there was no action or the action is display.
if (!isset($actions['action']) || $actions['action'] == 'display')
{
// It's a topic!  Must be!
if (isset($actions['topic']))
{
// Assume they can't view it, and queue it up for later.
$data[$k] = $txt['who_hidden'];
$topic_ids[(int) $actions['topic']][$k] = $txt['who_topic'];
}
// It's a board!
elseif (isset($actions['board']))
{
// Hide first, show later.
$data[$k] = $txt['who_hidden'];
$board_ids[$actions['board']][$k] = $txt['who_board'];
}
// It's the board index!!  It must be!
else 
{
$data[$k] = $txt['who_index'];
// ...or maybe it's just integrated into another system...
if (isset($modSettings['integrate_whos_online']) && function_exists($modSettings['integrate_whos_online']))
$data[$k] = $modSettings['integrate_whos_online']($actions);
}
}
// Probably an error or some goon?
elseif ($actions['action'] == '')
$data[$k] = $txt['who_index'];

// Some other normal action...?
else
{
// Viewing/editing a profile.
if ($actions['action'] == 'profile' || $actions['action'] == 'profile2')
{
// Whose?  Their own?
if (empty($actions['u']))
$actions['u'] = $url[1];

$data[$k] = $txt['who_hidden'];
$profile_ids[(int) $actions['u']][$k] = $actions['action'] == 'profile' $txt['who_viewprofile'] : $txt['who_profile'];
}
elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board']))
{
$data[$k] = $txt['who_hidden'];
$board_ids[(int) $actions['board']][$k] = isset($actions['poll']) ? $txt['who_poll'] : $txt['who_post'];
}
// A subaction anyone can view... if the language string is there, show it.
elseif (isset($actions['sa']) && isset($txt['whoall_' $actions['action'] . '_' $actions['sa']]))
$data[$k] = $txt['whoall_' $actions['action'] . '_' $actions['sa']];
// An action any old fellow can look at. (if ['whoall_' . $action] exists, we know everyone can see it.)
elseif (isset($txt['whoall_' $actions['action']]))
$data[$k] = $txt['whoall_' $actions['action']];
// Viewable if and only if they can see the board...
elseif (isset($txt['whotopic_' $actions['action']]))
{
// Find out what topic they are accessing.
$topic = (int) (isset($actions['topic']) ? $actions['topic'] : (isset($actions['from']) ? $actions['from'] : 0));

$data[$k] = $txt['who_hidden'];
$topic_ids[$topic][$k] = $txt['whotopic_' $actions['action']];
}
elseif (isset($txt['whopost_' $actions['action']]))
{
// Find out what message they are accessing.
$msgid = (int) (isset($actions['msg']) ? $actions['msg'] : (isset($actions['quote']) ? $actions['quote'] : 0));

$result db_query("
SELECT m.ID_TOPIC, m.subject
FROM (
{$db_prefix}boards AS b, {$db_prefix}messages AS m)
WHERE 
$user_info[query_see_board]
AND m.ID_MSG = 
$msgid
AND m.ID_BOARD = b.ID_BOARD
LIMIT 1"
__FILE____LINE__);
list ($ID_TOPIC$subject) = mysql_fetch_row($result);
$data[$k] = sprintf($txt['whopost_' $actions['action']], $ID_TOPIC$subject);
mysql_free_result($result);

if (empty($ID_TOPIC))
$data[$k] = $txt['who_hidden'];
}
// Viewable only by administrators.. (if it starts with whoadmin, it's admin only!)
elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' $actions['action']]))
$data[$k] = $txt['whoadmin_' $actions['action']];
// Viewable by permission level.
elseif (isset($allowedActions[$actions['action']]))
{
if (allowedTo($allowedActions[$actions['action']]))
$data[$k] = $txt['whoallow_' $actions['action']];
else
$data[$k] = $txt['who_hidden'];
}
// Unlisted or unknown action.
else
$data[$k] = $txt['who_unknown'];
}
}

// Load topic names.
if (!empty($topic_ids))
{
$result db_query("
SELECT t.ID_TOPIC, m.subject
FROM (
{$db_prefix}boards AS b, {$db_prefix}topics AS t, {$db_prefix}messages AS m)
WHERE 
$user_info[query_see_board]
AND t.ID_TOPIC IN (" 
implode(', 'array_keys($topic_ids)) . ")
AND t.ID_BOARD = b.ID_BOARD
AND m.ID_MSG = t.ID_FIRST_MSG
LIMIT " 
count($topic_ids), __FILE____LINE__);
while ($row mysql_fetch_assoc($result))
{
// Show the topic's subject for each of the actions.
foreach ($topic_ids[$row['ID_TOPIC']] as $k => $session_text)
$data[$k] = sprintf($session_text$row['ID_TOPIC'], censorText($row['subject']));
}
mysql_free_result($result);
}

// Load board names.
if (!empty($board_ids))
{
$result db_query("
SELECT b.ID_BOARD, b.name
FROM 
{$db_prefix}boards AS b
WHERE 
$user_info[query_see_board]
AND b.ID_BOARD IN (" 
implode(', 'array_keys($board_ids)) . ")
LIMIT " 
count($board_ids), __FILE____LINE__);
while ($row mysql_fetch_assoc($result))
{
// Put the board name into the string for each member...
foreach ($board_ids[$row['ID_BOARD']] as $k => $session_text)
$data[$k] = sprintf($session_text$row['ID_BOARD'], $row['name']);
}
mysql_free_result($result);
}

// Load member names for the profile.
if (!empty($profile_ids) && (allowedTo('profile_view_any') || allowedTo('profile_view_own')))
{
$result db_query("
SELECT ID_MEMBER, realName
FROM 
{$db_prefix}members
WHERE ID_MEMBER IN (" 
implode(', 'array_keys($profile_ids)) . ")
LIMIT " 
count($profile_ids), __FILE____LINE__);
while ($row mysql_fetch_assoc($result))
{
// If they aren't allowed to view this person's profile, skip it.
if (!allowedTo('profile_view_any') && $ID_MEMBER != $row['ID_MEMBER'])
continue;

// Set their action on each - session/text to sprintf.
foreach ($profile_ids[$row['ID_MEMBER']] as $k => $session_text)
$data[$k] = sprintf($session_text$row['ID_MEMBER'], $row['realName']);
}
mysql_free_result($result);
}

if (!is_array($urls))
return isset($data[0]) ? $data[0] : false;
else
return $data;
}

?>



Who.template.php - goes to Themes/default (usualy)

<?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>

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

<td><a href="' 
$scripturl '?action=trackip;searchip=' $member['ip'] . '" target="_blank" title="' $member['ip'] . '" class="smalltext2">' $member['ip'] . '</a></td>

</tr>'
;
   if ( !empty($member['ip']) ) {
                echo 
'<tr class="windowbg'$alternate '2' '''"><td colspan="4">';
    
echo '<span class="smalltext">';
echo '<b><a href="' $scripturl '?action=trackip;searchip=' $member['ip'] . '" target="_blank" title="' $member['ip'] . '" class="smalltext2">' $member['ip'] . '</a></b> (' host_from_ip($member['ip'])  . '), <acronym title="' $member['query']['USER_AGENT'] . '">' $member['agent'] . '</acronym>';
 
echo '<br /> User agent: ' $member['query']['USER_AGENT']; 
//echo '<br />';
//print_r ($context);

                
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,

),


                array (

'agent' => 'ccubee',

'spider' => true,

),

                array (

'agent' => 'Alcohol Search',

'spider' => true,

),

                array (

'agent' => 'Google Wireless Transcoder',

'spider' => true,

),

                array (

'agent' => 'ichiro',
'spidername' => 'Goo Japan / Inktomi robot',
'spider' => true,

),

                array (

'agent' => 'NaverBot',

'spider' => true,

),

                array (

'agent' => 'MJ12bot',
'spidername' => 'Majestic12',
'spider' => true,

),

                array (

'agent' => 'IsMySiteUp',
'spider' => true,

),

                array (

'agent' => 'MQBOT',
'spidername' => 'MetaQuerier',
'spider' => true,

),

                array (

'agent' => 'PHP version tracker ',

'spider' => true,

),

                array (

'agent' => 'Scooter',
'spidername' => 'AltaVista Scooter',
'spider' => true,

),

                array (

'agent' => 'Baiduspider',

'spider' => true,

),


                array (

'agent' => 'ilial',
'spidername' => 'UCLA Spider',
'spider' => true,

),


                array (

'agent' => 'silk',
'spidername' => 'Spider.com',
'spider' => true,

),


                array (

'agent' => 'Exabot',
'spidername' => 'Exalead',
'spider' => true,

),


                array (

'agent' => 'findlinks',
'spidername' => 'FindLinks',
'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;

}



?>



Pedja

Quote from: Zenigata on February 21, 2007, 09:15:54 PM
Hi,
how can I display the version of the browser? For example IE 6.0, Ie 7.0, Firefox 2.0, thanks.

Altered script I posted shows User agent, which contains browser and version.

Zenigata

Quote from: Pedja on February 22, 2007, 07:47:56 AM
I've done this.

I've this error:

Fatal error: smf_main() [function.require]: Failed opening required '/home/jwwwazen/public_html/forum/Sources/Who.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/jwwwazen/public_html/forum/index.php on line 344

کíŋ

Wow - thanks so much Pedja, works great!

Is there a way of showing any other user names that these IP's may belong to in that last column?   
کíŋ

NativePages

I might have messed up. I downloaded the recommended who.template.php file from http://www.simplemachines.org/community/index.php?topic=19243.msg762733#msg762733.

Because I have 24 other mods installed and couldn't remember if any had written to that file, I pulled the copy downloaded from this thread AND the copy sitting on my server in the default directory both into Winmerge and did a line by line check. 

I updated those lines in the copy from this thread that I'm pretty sure were NOT relevant to differentiating the spiders out from the members and guests. When I was done, the only things not changed between the two were very specific to the members, guests, spiders arrays and the list of spiders.

But I'm gettin' no changes on my forum after uploading the new who.template file. Did I mess up?

Adding question I forgot (on later edit).  How do I change the "name" from spiders to something else? My forum is not a tech-focused forum, and some of the potential members for my forum are paranoid and think the cookie left by the forums = purposefully distributed malware and virii. If I say on the front page there are "spiders" onboard, they may read it wrong. I would like to change it to something less intimidating like SearchBots.

NativePages
http://www.nativepages.com/tnindian
http://www.nativepages.com/tnindian
I came, I saw, I installed, I asked a million questions, but eventually I got it!


NativePages

Quote from: NativePages on February 26, 2007, 10:59:13 AM
I might have messed up. I downloaded the recommended who.template.php file from http://www.simplemachines.org/community/index.php?topic=19243.msg762733#msg762733.

Because I have 24 other mods installed and couldn't remember if any had written to that file, I pulled the copy downloaded from this thread AND the copy sitting on my server in the default directory both into Winmerge and did a line by line check. 

I updated those lines in the copy from this thread that I'm pretty sure were NOT relevant to differentiating the spiders out from the members and guests. When I was done, the only things not changed between the two were very specific to the members, guests, spiders arrays and the list of spiders.

But I'm gettin' no changes on my forum after uploading the new who.template file. Did I mess up?

Adding question I forgot (on later edit).  How do I change the "name" from spiders to something else? My forum is not a tech-focused forum, and some of the potential members for my forum are paranoid and think the cookie left by the forums = purposefully distributed malware and virii. If I say on the front page there are "spiders" onboard, they may read it wrong. I would like to change it to something less intimidating like SearchBots.

NativePages
http://www.nativepages.com/tnindian

This mod is still not functioning on my forum. Any help would be appreciated!
http://www.nativepages.com/tnindian
I came, I saw, I installed, I asked a million questions, but eventually I got it!

tsmalmbe

How would I change this to display RSS-readers as an own group?
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Advertisement: