Jump to content
Sign in to follow this  
Druide

User Tracking with Admin 1.31 Released

Recommended Posts

hello didier!

 

thanx for this contrib. it is exactly what i needed. i have been having some oddities and this will help me solve.... if you wanna see my dilema:

http://forums.oscommerce.com/index.php?showtopic=153770

 

between user_tracking and whos_online_enhancd this is helping alot.

 

But; neither has the user browser information displayed. at first, i thought about trying to add it to WOE, but after i found this contrib, that would be silly, it should be here!

 

so, how can i add the browser agent to this, it looks like it is already getting everything but, so should not be too hard to add the user browser, IE, FF, opera, etc etc...?

 

This would make this contrib absolutely complete!

 

let me know what you think about that, i am pretty mucha hack, not 'grammer per se.... but i get around!

 

thanx for your help!

 

fug

Share this post


Link to post
Share on other sites

I have been trying to open the Binary Format:http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz for the download but the maxmind data base is not sending it correctly. Any one have a copy they could e-mail to me? my email is emailanj@yahoo.com

Or should I just use the

CSV Format which I can download just fine. It says it takes up quite a bit of room in your mysql..

 

Thanks for any help.

anj

Share this post


Link to post
Share on other sites
Got it to work.  I changed the order in application_top to look like this....

 

Thanks.

  if ($spider_flag == false) {

      tep_session_start();

      $session_started = true;

    }

  } else {

    tep_session_start();

    $session_started = true;

  }

// user_tracking modifications

  if (!$referer_url) {

    $referer_url = $HTTP_SERVER_VARS['HTTP_REFERER'];

        if ($referer_url) {

            tep_session_register('referer_url');

        }

    }

for this error I did like your but not working !!!

 

I also have this error ...

 

Fatal error: Cannot redeclare tep_update_user_tracking() (previously declared in /home/site/public_html/includes/functions/user_tracking.php:18) in /home/site/public_html/includes/functions/user_tracking.php on line 16

anyone have idea how to fix this error ???

 

Thanks

Share this post


Link to post
Share on other sites
I have been trying to open the Binary Format:http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz for the download but the maxmind data base is not sending it correctly. Any one have a copy they could e-mail to me? my email is emailanj@yahoo.com

Or should I just use the 

CSV Format which I can download just fine. It says it takes up quite a bit of room in your mysql..

 

Thanks for any help.

anj

 

 

I used ASCII and it working fine :rolleyes:

Edited by cdllt

Share this post


Link to post
Share on other sites
I also have this error ...

 

Fatal error: Cannot redeclare tep_update_user_tracking() (previously declared in /home/site/public_html/includes/functions/user_tracking.php:18) in /home/site/public_html/includes/functions/user_tracking.php on line 16

anyone have idea how to fix this error ???

 

Thanks

That means you probably have function user_tracking() on line 16 & 18. You can only create a function once in a script.

Share this post


Link to post
Share on other sites
That means you probably have function user_tracking() on line 16 & 18. You can only create a function once in a script.

how can I ban entire "country" ? anyone have an idea how?

please

Share this post


Link to post
Share on other sites

The contrib seems to work for me with everything but "referer url". I've tried to change the place for the code in application_top.php as suggested in previous post but with no success. No results show up in database either.

 

 

This is my application_top right now...

 

// start the session
 $session_started = false;
 if (SESSION_FORCE_COOKIE_USE == 'True') {
   tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

   if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
    
tep_session_start();
     $session_started = true;
       } 

// user_tracking modifications 
  if (!$referer_url) { 
   $referer_url = $HTTP_SERVER_VARS['HTTP_REFERER']; 
       if ($referer_url) { 
           tep_session_register('referer_url'); 
   }  
 }

 

I installed the contrib just to get the referal-url's so I would be very glad if someone could point me in the right direction.

 

Thank you,

Michael

Share this post


Link to post
Share on other sites
The contrib seems to work for me with everything but "referer url". I've tried to change the place for the code in application_top.php as suggested in previous post but with no success. No results show up in database either.

This is my application_top right now...

 

// start the session
?$session_started = false;
?if (SESSION_FORCE_COOKIE_USE == 'True') {
? ?tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

? ?if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
? ? 
tep_session_start();
? ? ?$session_started = true;
? ? ? ?} 

// user_tracking modifications 
? if (!$referer_url) { 
? ?$referer_url = $HTTP_SERVER_VARS['HTTP_REFERER']; 
? ? ? ?if ($referer_url) { 
? ? ? ? ? ?tep_session_register('referer_url'); 
? ?} ?
?}

 

I installed the contrib just to get the referal-url's so I would be very glad if someone could point me in the right direction.

 

Thank you,

Michael

 

 

Hi, I have this in my application_top:

 

// start the session
 $session_started = false;
 if (SESSION_FORCE_COOKIE_USE == 'True') {
   tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

   if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
     tep_session_start();
     // user_tracking modifications
        if (!$referer_url) {
          $referer_url = $HTTP_SERVER_VARS['HTTP_REFERER'];
            if ($referer_url) {
              tep_session_register('referer_url');
            }
        }
     $session_started = true;
   }
 } elseif (SESSION_BLOCK_SPIDERS == 'True') {
   $user_agent = strtolower(getenv('HTTP_USER_AGENT'));
   $spider_flag = false;

   if (tep_not_null($user_agent)) {
     $spiders = file(DIR_WS_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 ($spider_flag == false) {
     tep_session_start();
     // user_tracking modifications
        if (!$referer_url) {
          $referer_url = $HTTP_SERVER_VARS['HTTP_REFERER'];
            if ($referer_url) {
              tep_session_register('referer_url');
            }
        }
     $session_started = true;
   }
 } else {
   tep_session_start();
   // user_tracking modifications
      if (!$referer_url) {
        $referer_url = $HTTP_SERVER_VARS['HTTP_REFERER'];
          if ($referer_url) {
            tep_session_register('referer_url');
          }
      }
   $session_started = true;
 }

 

Maybe it helps...

G?tz

Share this post


Link to post
Share on other sites

Thank you very much G?tz! Seems like I missed to add the referer-tracking on some places. Now it works like a charm! :D

 

Thanks,

Michael

Share this post


Link to post
Share on other sites

Hi everyone, I just installed this and am getting an error

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /hsphere/local/home/account/site/admin/includes/functions/database.php:13) in /hsphere/local/home/account/site/admin/includes/functions/database.php on line 13

 

Anyone have any ideas on what could be wrong.

 

Thanks a million, :D

Chris

Share this post


Link to post
Share on other sites
Hi everyone, I just installed this and am getting an error

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /hsphere/local/home/account/site/admin/includes/functions/database.php:13) in /hsphere/local/home/account/site/admin/includes/functions/database.php on line 13

 

Anyone have any ideas on what could be wrong.

 

Thanks a million, :D

Chris

That means you are creating the function again. It can only be made once. You shouldn't have the function in any other file except hsphere/local/home/account/site/admin/includes/functions/database.php &

hsphere/local/home/account/site/includes/functions/database.php

Share this post


Link to post
Share on other sites
That means you are creating the function again. It can only be made once. You shouldn't have the function in any other file except hsphere/local/home/account/site/admin/includes/functions/database.php &

hsphere/local/home/account/site/includes/functions/database.php

 

Ok, I searched around and I have the function called in application_top.php in both my admin and catalog directories. (as well as in database.php of both directories)

 

So what am I supposed to do? OSC came stock like this. Now that I installed this contrib, it is complaining about this... The problem must be something else that is triggering this.

 

Chris

Share this post


Link to post
Share on other sites

Has anyone used this along with page cache? Everything was fine until I installed page cache and now I'm getting only about 10% of my visitors logged in this contrib. I'm sure it has to do with missing session ids or something else related to the cached pages.

 

Any ideas?

 

I also have ultimate SEO urls installed.

Share this post


Link to post
Share on other sites

This is driving me nuts!! I have had this tracking system on my site for about 4 months and all was fine. Then around the 1st of the year it stopped recording all activity except mine, and then only if I don't put in my exclude IP address.

 

I have looked at the code from about 3 months ago and compared it with the code today. No Change. I have check permissions but I don't think there is a file other than the SQL file that it logs to. If I am wrong then that could be a problem.

 

I have re-examined all of my configuration settings and recreated the database file. Still not recording anyone else's activity.

 

Obviously I have changed something somewhere that is affecting this contribution but for the life of me I cannot figure it out.

 

I know I am getting activity because I can see it in Supertracker, which is also a good contribution but it doesn't track the session like this one does.

 

Any clues as to why I cannot get it to record activity? HELP!!!!

Edited by RGStephens

Share this post


Link to post
Share on other sites

Well, I also got some weird problems with this one.

 

Did you try to empty the table "user_tracking" ? Do not DROP the table but just empty it. Use SQL instead of the "delete all data" from the admin page. I do not remember if it works well in my 1.40.2 version.

 

Didier.

Share this post


Link to post
Share on other sites

I am using v1.40.2 and most seems to work well except none of the purge functions work. Is "purge all records past 72 hours" working for others in this version? No error message, just no respose to clicking the links.

 

Jim

Share this post


Link to post
Share on other sites
I recently had a problem with the user tracking admin display loading very slowly (in excess of 60secs) and saw from browsing the forum that a couple other people had the same problem. Forgive me for reposting if a solution to this has already been found.

 

Basically, the bottleneck in the script is the line in the admin/user_tracking.php file that contains 'gethostbyaddr'. Basically what this is doing is calling the system to do a hostname lookup on every single ip address on the page, and it does this for every page hit (for example, if you click view session, it again tries a reverse lookup on every ip addr on the page). If any of these lookups fails, the script will hang there for a few secs before moving on.

 

The quick solution to this is to comment out that line (change 'echo gethostbyaddr' to '//echo gethostbyaddr').

 

I have modified my install so that the store does a reverse dns the first time the user visits the store, stores this info in the database, and then sets a session variable so that this lookup doesnt occur again. This has speeded up the script operation for me tremendously, and the page loads in about 3 secs with 700-1000 users' information.

 

Hopefully other will find this information useful, and again good job to the author of User Tracking for an awesome contribution. I think it is probably the coolest contribution I have seen, and is always my first stop when i log into my admin

 

Yes, I found your information useful, and revised the user_tracking 1.4.2 file to not use the gethostbyaddr function, but still show the host name by running a reverse dns lookup using a customized function.

To use it you just have to copy and past the following code into your admin/user_tracking.php, overwriting all the previous code and uploading it to its directory.

You MUST revise the $dns value to be your host dns IP address instead of the 222.222.222.222 and you may increase the timeout as well, in case it is not showing many hosts, or if it doesn't show them at all

If this doesn't work for you it can mean 1 or both of these value is incorrect...

 

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
 User Tracking with Admin Version 1.4.3
 Modified by dr_lucas to have optimal script speed by replacing the gethostbyaddr function to a customized function which is changing the timeout of the reverse DNS lookup
 April 27th, 2006
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_USER_TRACKING);
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

 require(DIR_WS_INCLUDES . 'geoip.inc');
 $gi = geoip_open(DIR_WS_INCLUDES . 'GeoIP.dat',GEOIP_STANDARD);

 $LIMIT_DISPLAY_SESSIONS = CONFIG_USER_TRACKING_SESSION_LIMIT; 
//  $MIN_CLICK_COUNT = 1;
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td class="smallText">

<?php 
 if ($custmid == '0') 
 { 
tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " where customer_id = 0"); 
echo "<font color=red>" . TEXT_DELETE_CUSTOMER_GUEST . '</font><p>'; 
 }
 if ($purge == '72') 
 { 
tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " where time_last_click < '"  . (time() - ($purge * 3600))."'"); 
echo "<font color=red>" . TEXT_HAS_BEEN_PURGED . '</font><p>'; 
 }
 if ($purge == '0') 
 { 
tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " where time_last_click < '"  . (time() - ($purge * 3600))."'"); 
echo "<font color=red>" . TEXT_HAS_BEEN_PURGED . '</font><p>';
 }	
 if ($delip == '1')
 {
tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " WHERE ip_address = '" . CONFIG_USER_TRACKING_EXCLUDED . "'");
echo "<font color=red>" . TEXT_DELETE_IP_OK_1 . CONFIG_USER_TRACKING_EXCLUDED . ' ' . TEXT_DELETE_IP_OK_2 . '.</font><p>';
$delip='0';
 }
 if ($delip == '2')
 {
tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " WHERE ip_address = '" . $user_tracking_excluded . "'");
echo TEXT_DELETE_IP_OK_1 . $user_tracking_excluded . ' ' . TEXT_DELETE_IP_OK_2 . '.<p>';
$delip='0';
 }
if ($delnosession == '1')
 {
tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " WHERE session_id = ''");
echo TEXT_DELETE_OK . '<p>';
$delnosession='0';
  }
 if ($delsession)
 {
tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " WHERE session_id = '" . $delsession . "'");
echo $delsession . ' has been deleted. <p>';
  }

 echo EXPLAINATION, "<p>";

 // some time routines
 $time_frame = time();
 if ($HTTP_GET_VARS['time'])
 { 
$time_frame = $HTTP_GET_VARS['time'];
 }

// only display if all sessions are displayed
if (!isset($HTTP_GET_VARS['viewsession']) && $HTTP_GET_VARS['viewsession'] == '')
{
 echo '<b>' . TEXT_SELECT_VIEW .': </b>';
 echo '<a href="' . FILENAME_USER_TRACKING . '?time=';
 echo $time_frame - 86400 . '">' . "<font color=blue><b>" . TEXT_BACK_TO . ' ' . date("d M Y", $time_frame - 86400) . '</b></font color></a> ';
if (time() > $time_frame + 86400)
 {
echo '| <a href="' . FILENAME_USER_TRACKING . '?time=';
echo $time_frame + 86400 . '">' . "<font color=blue><b>" . TEXT_FORWARD_TO . date("d M Y", $time_frame + 86400) . '</b></font color></a>';
 }


 echo "<p>" . TEXT_DISPLAY_START . $LIMIT_DISPLAY_SESSIONS . TEXT_DISPLAY_END . '<p>';
 echo TEXT_PURGE_START . ' <a href="' . FILENAME_USER_TRACKING . '?purge=72">'. "<font color=blue><b>" . TEXT_PURGE_RECORDS. '</a></b></font color> ' .  TEXT_PURGE_END. '</font><p>';
 echo TEXT_PURGE_START . ' <a href="' . FILENAME_USER_TRACKING . '?custmid=0">'. "<font color=blue><b>" . TEXT_PURGE_RECORDS. '</a></b></font color> ' .  TEXT_PURGE_CUSTMID_END. '</font><p>';
 echo TEXT_PURGE_START . ' <a href="' . FILENAME_USER_TRACKING . '?purge=0">'. "<font color=blue><b>" . TEXT_PURGE_RECORDS. '</a></b></font color> ' .  TEXT_PURGE_ALL. ' </font>' . '<font color=red><b>' . TEXT_BEWAREDELETE . '</b></font color><p>';
 echo TEXT_DELETE_IP . CONFIG_USER_TRACKING_EXCLUDED . ' <a href="' . FILENAME_USER_TRACKING . '?delip=1">'. "<font color=blue><b>" . TEXT_PURGE_RECORDS. '</a></b></font><p>';
 echo TEXT_DELETE_NOIP . ' <a href="' . FILENAME_USER_TRACKING . '?delnosession=1">' . "<font color=blue><b>" . TEXT_DELETE_NOW . '</b></a> ' . '</font><p>';
php?>
<tr>
 <form name="del_ip" <?php echo 'action="' . tep_href_link(FILENAME_USER_TRACKING . '?delip=2') . '"'; ?> method="post">
	<td><table border="0" cellspacing="0" cellpadding="2">
	  <tr>


		<td class="main"><?php echo '<font size="1">' . TEXT_DELETE_IP . '</font>'; ?> </td>
		<td class="main"><?php echo tep_draw_input_field('user_tracking_excluded', (isset($sInfo->user_tracking_excluded) ? $sInfo->user_tracking_excluded : '')); ?></td>
		<td class="main" valign="top"><?php echo (($form_action == 'user_tracking_excluded') ? tep_image_submit('button_insert.gif', IMAGE_INSERT) : tep_image_submit('button_delete.gif', IMAGE_DELETE)). '</a>'; ?></td>
	  </tr>
	</table></td>
  </form>
</tr>
<?
}

// we need to slurp all the customer tracking information out of the database
if (isset($HTTP_GET_VARS['viewsession']) && $HTTP_GET_VARS['viewsession'] != '')
{
 // display selected session
 $whos_online_query = 
			   tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, page_desc, referer_url," .
			   " session_id from " . TABLE_USER_TRACKING  . 
			   " where session_id = '" . $HTTP_GET_VARS['viewsession'] . "' order by time_last_click desc");
} else {
 // read all sessions
 $whos_online_query = 
			   tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, page_desc, referer_url," .
			   " session_id from " . TABLE_USER_TRACKING  . 
			   " where time_entry > " . ($time_frame - 86400) . 
			   " and time_entry < " . $time_frame . 
			   " order by time_last_click desc");
}
 $results = 0;
 while ($whos_online = tep_db_fetch_array($whos_online_query)) 
 {
 $user_tracking[$whos_online['session_id']]['session_id']=$whos_online['session_id'];
 $user_tracking[$whos_online['session_id']]['ip_address']=$whos_online['ip_address'];
 $user_tracking[$whos_online['session_id']]['customer_id']=$whos_online['customer_id'];
 $user_tracking[$whos_online['session_id']]['referer_url']=$whos_online['referer_url'];


if ($whos_online['full_name'] != 'Guest') 
	$user_tracking[$whos_online['session_id']]['full_name'] = '<font color="0000ff"><b>' . $whos_online['full_name'] . '</b></font>';

 $user_tracking[$whos_online['session_id']]['last_page_url'][$whos_online['time_last_click']] = $whos_online['last_page_url'];
 $user_tracking[$whos_online['session_id']]['page_desc'][$whos_online['time_last_click']] = $whos_online['page_desc']; 

 if (($user_tracking[$whos_online['session_id']]['time_entry'] > $whos_online['time_entry']) ||
	 (!$user_tracking[$whos_online['session_id']]['time_entry']))
	  $user_tracking[$whos_online['session_id']]['time_entry'] = $whos_online['time_entry'];
 if (($user_tracking[$whos_online['session_id']]['end_time'] < $whos_online['time_entry']) ||
	 (!$user_tracking[$whos_online['session_id']]['end_time']))
	  $user_tracking[$whos_online['session_id']]['end_time'] = $whos_online['time_entry'];
 $results ++;
 }

?>
	<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr> 
  <td valign="top" align=center><table border="0" width="95%" cellspacing="0" cellpadding="2"> 

<?php

 // now let's display it

$listed=0;
if ($results)
while (($ut = each($user_tracking)) && ($listed++ < $LIMIT_DISPLAY_SESSIONS)) 
{

//  if (count($ut['value']['last_page_url']) > $MIN_CLICK_COUNT) {
 if (count($ut['value']['last_page_url']) > CONFIG_USER_TRACKING_CLICK_COUNT) {

  $time_online = (time() - $ut['value']['time_entry']);
  if ( ((!$HTTP_GET_VARS['info']) || (@$HTTP_GET_VARS['info'] == $ut['value']['session_id'])) && (!$info) ) {
 $info = $ut['value']['session_id'];
}
echo '
   <tr class="dataTableHeadingRow"> 
	<td class="dataTableHeadingContent" colspan="5">'.TABLE_HEADING_SESSION_ID .'</td> 
	<td class="dataTableHeadingContent" colspan="1 width="150">'.TEXT_USER_SHOPPING_CART.'</td> 
   </tr>';


  echo '			  <tr class="dataTableRowSelected">' . "\n";

  if ($ut['value']['full_name'] == "")
	$ut['value']['full_name'] = "Guest";
?>
			<td colspan = "5" class="dataTableContent" valign="top"></b><a name="<?php echo $ut['value']['session_id'];?>"><?php echo $ut['value']['full_name'] . '</b> (' . $ut['value']['session_id'] . ")   <a href=\"user_tracking.php?time=" . $time_frame . "&delsession=" . $ut['value']['session_id'] . "\"><font color=red>[" . TEXT_DELETE_SESSION . "]</font></a>" . " <a href=\"user_tracking.php?time=" . $time_frame . "&viewsession=" . $ut['value']['session_id'] . "#" . $ut['value']['session_id'] . "\"><font color=green>[" . TEXT_VIEW_SESSION . "]</font></a>";?></td>
<?php

// shopping cart decoding
$session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $ut['value']['session_id'] . "'");
if (tep_db_num_rows($session_data)) {
  $session_data = tep_db_fetch_array($session_data);
  $session_data = trim($session_data['value']);
} else {
  $session_data = @file(tep_session_save_path() . '/sess_' . $ut['value']['session_id']);
  $session_data = trim($session_data[0]);
}   
$cart = "";
//	$referer_url = "";
$num_sessions ++;
session_decode($session_data);

$contents = array();
if (is_object($cart)) {
  $products = $cart->get_products();
  for ($i=0; $i<sizeof($products); $i++) {
	$contents[] = array('text' => $products[$i]['quantity'] . ' x ' . $products[$i]['name']);
  } 
  if (sizeof($products) > 0) {
	$contents[] = array('text' => tep_draw_separator('pixel_black.gif', '100%', '1'));
	$contents[] = array('align' => 'right', 'text'  => TEXT_SHOPPING_CART_SUBTOTAL . ' ' . $currencies->format($cart->show_total(), true, $currency));
  } else {
	$contents[] = array('text' => ' ');
  }
}

$heading = array();

if (tep_not_null($contents)) 
{
  echo '			<td rowspan="4" valign="top">' . "\n";
  $box = new box;
  echo $box->infoBox($heading, $contents);	   
  echo '			</td>' . "\n";
}
else 
{
  echo '			<td rowspan="4" valign="top" class="dataTableContent" align="center">session expired' . "\n";
  echo '			</td>' . "\n";
}

?>

		  </tr>
		  <tr>
	<td class="dataTableContent" align="right" valign="top"><b>Click Count:</b></td> 
	<td class="dataTableContent" valign="top"><font color=FF0000><b><?php echo count($ut['value']['last_page_url']);?></b></font></td>
	<td class="dataTableContent" colspan=2 rowspan=4 align="center"> 
<table border="0" width="100%" cellspacing="0" cellpadding="2"> 
  <?php
  $today = getdate();
  $midnight = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']);
  ?>
 <tr> 
<td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_ENTRY_TIME; ?></b></td>
<td class="dataTableContent" colspan="2" valign="top"><?php echo date('d/m/Y H:i:s', $ut['value']['time_entry']); ?></td>
<td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_IDLE_TIME ?></b></td>
<td class="dataTableContent" colspan="2" valign="top"><?php echo date('H:i:s', ($midnight + time() - $ut['value']['end_time'])); ?></td>
 </tr>
 <tr>
<td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_END_TIME; ?></b></td>
<td class="dataTableContent" colspan="2" valign="top"><?php echo date('d/m/Y H:i:s', $ut['value']['end_time']); ?></td>
<td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_TOTAL_TIME ?></b></td>
<td class="dataTableContent" colspan="2" valign="top"><b><?php echo date('H:i:s', ($midnight + $ut['value']['end_time'] - $ut['value']['time_entry'])); ?></b></td> 
 </tr>
</table> 
	</td> 
		  </tr>
		  <tr>
	<td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_COUNTRY ?></b></td> 
	<td class="dataTableContent" valign="top"><?php echo tep_image(DIR_WS_FLAGS . strtolower(geoip_country_code_by_addr($gi, $ut['value']['ip_address'])) . '.gif', geoip_country_name_by_addr($gi, $ut['value']['ip_address'])); ?> <?php echo geoip_country_name_by_addr($gi, $ut['value']['ip_address']); ?></td> 
   </tr> 
		  <tr>
	<td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_IP_ADDRESS ?></b></td> 
	<td class="dataTableContent" valign="top"><?php echo '<a href="'  . USER_TRACKING_WHOIS_URL . $ut['value']['ip_address']; ?>" target="_new"><?php echo $ut['value']['ip_address']; ?></a></td> 
   </tr> 
   <tr> 
	<td class="dataTableContent" align="right" valign="top"><b><?php echo TABLE_HEADING_HOST ?></b></td>


<? //Dr_Lucas BOF: No more slow user_tracking contribution

$ip = ($ut['value']['ip_address']);
$dns = "222.222.222.222";  //<--This value must be changed to your HOST DNS server IP instead

if ( function_exists('gethostbyaddr_timeout') )
{
  echo;
} else {

function gethostbyaddr_timeout($ip, $dns, $timeout=30) //<--The timeout miliseconds value can be changed to a one suitable for you, note that the longer the allowed timeout, the longer time this function has to find the host name
/////
{
  // random transaction number (for routers etc to get the reply back)
  $data = rand(0, 99);
  // trim it to 2 bytes
  $data = substr($data, 0, 2);
  // request header
  $data .= "\1\0\0\1\0\0\0\0\0\0";
  // split IP up
  $bits = explode(".", $ip);
  // error checking
  if (count($bits) != 4) return "ERROR";
  // there is probably a better way to do this bit...
  // loop through each segment
  for ($x=3; $x>=0; $x--)
  {
   // needs a byte to indicate the length of each segment of the request
   switch (strlen($bits[$x]))
   {
	   case 1: // 1 byte long segment
		   $data .= "\1"; break;
	   case 2: // 2 byte long segment
		   $data .= "\2"; break;
	   case 3: // 3 byte long segment
		   $data .= "\3"; break;
	   default: // segment is too big, invalid IP
		   return "INVALID";
   }
   // and the segment itself
   $data .= $bits[$x];
  }
  // and the final bit of the request
  $data .= "\7in-addr\4arpa\0\0\x0C\0\1";
  // create UDP socket
  $handle = @fsockopen("udp://$dns", 53);
  // send our request (and store request size so we can cheat later)
  $requestsize=@fwrite($handle, $data);

  @socket_set_timeout($handle, $timeout - $timeout%1000, $timeout%1000);
  // hope we get a reply
  $response = @fread($handle, 1000);
  @fclose($handle);
  if ($response == "")
   return $ip;
  // find the response type
  $type = @unpack("s", substr($response, $requestsize+2));
  if ($type[1] == 0x0C00)  // answer
  {
   // set up our variables
   $host="";
   $len = 0;
   // set our pointer at the beginning of the hostname
   // uses the request size from earlier rather than work it out
   $position=$requestsize+12;
   // reconstruct hostname
   do
   {
	   // get segment size
	   $len = unpack("c", substr($response, $position));
	   // null terminated string, so length 0 = finished
	   if ($len[1] == 0)
		   // return the hostname, without the trailing .
		   return substr($host, 0, strlen($host) -1);
	   // add segment to our host
	   $host .= substr($response, $position+1, $len[1]) . ".";
	   // move pointer on to the next segment
	   $position += $len[1] + 1;
   }
   while ($len != 0);
   // error - return the hostname we constructed (without the . on the end)
   return $ip;
  }
  return $ip;
}
}
$revhost=gethostbyaddr_timeout($ip,$dns);
?>


	<td class="dataTableContent" valign="top"><?php echo $revhost; ?></td>

<? //Dr_Lucas EOF: No more slow user_tracking contribution ?>

   </tr> 
   <tr> 
	<td class="dataTableContent" align="right" valign="top"><b><?php echo TEXT_ORIGINATING_URL ?></b></td> 
<?php 
$ref_name = chunk_split($referer_url,40,"<br>"); 
?> 
<td class="dataTableContent" align="left" valign="top" colspan=3><?php echo '<a href="'. $ut['value']['referer_url'] .'" target="_new">'. $ut['value']['referer_url'] .'</a>'; ?> </td> 
   </tr> 
   <tr> 
	<td class="dataTableContent"></td> 
	<td class="dataTableContent" colspan=3> 
	<table border="0" cellspacing="1" cellpadding="2" bgcolor=999999 width=100%>
<?php 
// View session
if ($viewsession != '' && $viewsession == $ut['value']['session_id']){ 
 while (($pu = each($ut['value']['last_page_url']))&&($du = each($ut['value']['page_desc']))) 
 { 

?> 
	  <tr bgcolor=ffffff> 
		<td class="dataTableContent" valign=top align="right"><?php echo date('H:i:s', $pu['key']); ?></td> 
		<td class="dataTableContent" nowrap valign=top align="left"> <a href="<?php echo $pu['value']; ?>" target="_new"><?php if ($du['value']!=''){ echo $du['value'];} ?></a> </td> 
		<td class="dataTableContent" width=100% align="left"><a href="<?php echo $pu['value']; ?>" target="_new"><?php echo chunk_split($pu['value'],40,"<br>"); ?></a></td> 
	  </tr> 
<?php 
 } 
} 
echo'		</table> 
  </td> 
 </tr> ';
}
} 
?> 
   <tr> 
	<td class="smallText" colspan="7"><b><font color=blue><?php echo sprintf(TEXT_NUMBER_OF_PAGES, tep_db_num_rows($whos_online_query)); echo TEXT_NUMBER_OF_CUSTOMERS, $num_sessions . "."; ?></font></b></td> 
   </tr> 
  </table></td> 
 </tr> 
</table> 
  </td> 
  </tr> 
 </table></td> 
<!-- body_text_eof //--> 
</tr> 
</table> 
<!-- body_eof //--> 

<!-- footer //--> 
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 
<!-- footer_eof //--> 
<br> 
</body> 
</html> 
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Edited by dr_lucas

Share this post


Link to post
Share on other sites

Forgot to say:

You may check your host server DNS IP by running a DNS lookup (Choose ALL in the drop-down menu) in the following URL: http://www.dnsstuff.com/

Use this as your $dns value

Share this post


Link to post
Share on other sites
I am using v1.40.2 and most seems to work well except none of the purge functions work. Is "purge all records past 72 hours" working for others in this version? No error message, just no respose to clicking the links.

 

Jim

 

Try changing this line from admin/user_tracking.php for "purge all records past 72 hours"

 

 

tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " where time_last_click < '" . (time() - ($purge * 3600))."'");

 

to

 

	tep_db_query("delete from " . TABLE_USER_TRACKING . " where time_last_click < " . ($time_frame - ($purge * 3600)));

 

You can also change the "purge all records" code from:

 

tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " where time_last_click < '" . (time() - ($purge * 3600))."'");

 

to:

 

tep_db_query("truncate " . TABLE_USER_TRACKING );

Share this post


Link to post
Share on other sites
I am using v1.40.2 and most seems to work well except none of the purge functions work. Is "purge all records past 72 hours" working for others in this version? No error message, just no respose to clicking the links.

 

Jim

 

Try changing this line from admin/user_tracking.php for "purge all records past 72 hours"

 

 

tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " where time_last_click < '" . (time() - ($purge * 3600))."'");

 

to

 

	tep_db_query("delete from " . TABLE_USER_TRACKING . " where time_last_click < " . ($time_frame - ($purge * 3600)));

 

You can also change the "purge all records" code from:

 

tep_db_query("DELETE FROM " . TABLE_USER_TRACKING . " where time_last_click < '" . (time() - ($purge * 3600))."'");

 

to:

 

tep_db_query("truncate " . TABLE_USER_TRACKING );

Share this post


Link to post
Share on other sites

Sorry 'bout the double post! Only hit submit once...promise :) but it took forever to load and then there were two.

 

If a mod or admin sees this -- please delete this post and the duplicate above.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×