Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

GEOIP - Displaying visitor country flag in whos_online.php


Guest

Recommended Posts

Hello,

 

I don't know if this topic is allowed or not, so please tell me if it's OK to talk about this on this website.

 

I've made some small alterations to whos_online.php to enable the display to show WHERE the visitor is coming from.

 

Hey, it's no Google Analytics but it is fun to watch. It shows the country flag of the visitor.

 

UpgradedWhosOn.jpg

 

I also coded the page so that it re-loads every 10 seconds so I don't have to press F5 all the time. It's fun to watch.

 

If you find it useful I'm happy to post the (small) changes I made.

 

If someone has already done this and I'm being redundant, I apologize.

 

If someone has already done something better, I'd like to know about it.

 

My next step for this code is to try to show the CITY of the visitor as well.

 

Graham Leach, Co-Proprietor

Authentic Closet

Link to comment
Share on other sites

Pop it in as a contribution.

 

People love toys......

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Easy, easy

 

in /catalog/admin/whos_online.php

 

Change the order and names of column headings in display:

 

~line 60

 

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ONLINE; ?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ENTRY_TIME; ?></td>

<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_LAST_CLICK; ?></td>

<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_CUSTOMER_ID; ?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FULL_NAME; ?></td>

<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_IP_ADDRESS; ?></td>

<!-- Added By GL -->

<td class="dataTableHeadingContent" align="center">Country</td>

<!----------------->

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LAST_PAGE_URL; ?> </td>

</tr>

Then change the actual column members to reflect column headings:

 

~line 79

 

if ($whos_online['session_id'] == $info) {

echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout=

"rowOutEffect(this)">' . "\n";

} else {

echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick=

"document.location.href=\'' . tep_href_link(FILENAME_WHOS_ONLINE, tep_get_all_get_params(array('info', 'action')) . 'info=' .

$whos_online['session_id'], 'NONSSL') . '\'">' . "\n";

}

?>

<td class="dataTableContent"><?php echo gmdate('H:i:s', $time_online); ?></td>

<td class="dataTableContent"><?php echo date('H:i:s', $whos_online['time_entry']); ?></td>

<td class="dataTableContent" align="center"><?php echo date('H:i:s', $whos_online['time_last_click']); ?></td

>

<td class="dataTableContent" align="center"><?php echo $whos_online['customer_id']; ?></td>

<td class="dataTableContent"><?php echo $whos_online['full_name']; ?></td>

<td class="dataTableContent" align="center"><?php echo $whos_online['ip_address']; ?></td>

<!-- Added by GL BEGIN -->

<td class="dataTableContent" align="center">

<img src="http://api.hostip.info/flag.php?ip=

<?php echo $whos_online['ip_address']; ?>" height=14 width=24 >

</td>

<!-- Added by GL END -->

<td class="dataTableContent"><?php if (eregi('^(.*)' . tep_session_name() . '=[a-f,0-9]+[&]*(.*)', $whos_onli

ne['last_page_url'], $array)) { echo $array[1] . $array[2]; } else { echo $whos_online['last_page_url']; } ?> </td>

</tr>

 

 

Done from memory. I think that's it. If not, let me know and I'll adjust the posting until it works.

 

Enjoy

 

Graham Leach, Co-Proprietor

Authentic Closet

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...