This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Alternative admin panel->Tools->viewers
#1

I'm very pleased by the script commentics, I want to thank the author for this great job. Here is my small addition to the script . With this addition you are able to see the image of the search engine instead of the image of the spider in the
admin panel->Tools->viewers

[Image: Screenshot_1.png]

the change is in the file
/comments/admin_/includes/pages/tool_viewers.php

line 69 was:
PHP Code:
<?php 
while ($viewer = mysql_fetch_assoc($viewers)) {
?>
<tr>
<?php if (!empty($viewer["user_agent"]) && is_spider($viewer["user_agent"])) { ?> <td><img src="<?php echo "images/viewers/spider.png";?>" class="viewer" title="Spider" alt="Spider"></td> <?php } else { ?> <td><img src="<?php echo "images/viewers/person.png";?>" class="viewer" title="Person" alt="Person"></td> <?php } ?>
<td><?php echo $viewer["ip_address"]; ?></td>
<td><?php echo $viewer["page_reference"]; ?></td>
<td><?php echo "<a href='" . $viewer["page_url"] . "' target='_blank'>" . $viewer["page_url"] . "</a>"; ?></td>
<td><span style="display:none;"><?php echo $viewer["timestamp"]; ?></span><?php echo date("i\m s\s", $timestamp - $viewer["timestamp"]); ?></td>
</tr>
<?php } ?>

has to become:
PHP Code:
<?php 
function ipOrSpider($user_agent,$ip_address){
$ipOrSpider=Array();
if (
preg_match('/Googlebot|naver\.com|YoudaoBot|bingbot|Baiduspider|(?:Sogou web spider)|Sosospider|(?:Yahoo. Slurp)/',$user_agent)){
if (
preg_match('/http(.*?\\.com)/',$user_agent, $spiderA)) {
$spider = $spiderA[0];
$domain = parse_url($spider, PHP_URL_HOST);
$domain = preg_replace('/(.*?)\\.(.*?)\\./si', '$2.', $domain);
if (
preg_match('/YoudaoBot/',$user_agent)){
$ipOrSpider['img'] = "http://shared.ydstatic.com/images/favicon.ico";
}else if (
preg_match('/naver/',$user_agent)){
$ipOrSpider['img'] = "http://www.naver.com/favicon.ico";
}else{
$ipOrSpider['img'] = htmlspecialchars($spider)."/favicon.ico";
}
$ipOrSpider['name'] = htmlspecialchars($domain);
return
$ipOrSpider;
} else {
$ipOrSpider['img'] = "images/viewers/spider.png";
$ipOrSpider['name'] = htmlspecialchars($user_agent);
return
$ipOrSpider;
}
}
$ipOrSpider['img'] = "images/viewers/person.png";
$ipOrSpider['name'] = $ip_address;
return
$ipOrSpider;
}

$viewers = mysql_query("SELECT * FROM `".$mysql_table_prefix."viewers` ORDER BY timestamp DESC LIMIT 0,200");
while (
$viewer = mysql_fetch_assoc($viewers)) {
$ipOrSpider = ipOrSpider($viewer["user_agent"],$viewer["ip_address"]);
?>
<tr>
<td><img src="<?php echo $ipOrSpider['img']; ?>" class="viewer" title="" alt=""></td>
<td><?php echo $ipOrSpider['name']; ?></td>
<td><?php echo $viewer["page_reference"]; ?></td>
<td><?php echo "<a href='" . $viewer["page_url"] . "' target='_blank'>" . $viewer["page_url"] . "</a>"; ?></td>
<td><span style="display:none;"><?php echo $viewer["timestamp"]; ?></span><?php echo date("i\m s\s", $timestamp - $viewer["timestamp"]); ?></td>
</tr>
<?php } ?>

Reply
#2

and probably a change in css of this forum change font-size: 13px; to font-size: 12px; in global.css for ".codeblock code"

PHP Code:
<?php 
.codeblock code{
...
font-size: 12px;
...
}

Reply
#3

Nice contribution, thanks!

Have you completed the interview?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post

Forum Jump:


Users browsing this thread: 1 Guest(s)