Jump to content
Sign in to follow this  
Druide

User Tracking with Admin 1.31 Released

Recommended Posts

Since my host moved my account to a new server I am having a problem with being logged off with the first link click on user_tracking.php

 

I click a link (view session, delete session, purge records, etc) and am logged off -- once I log back there is no problem for the remainder of the session.

 

Any suggestions?

Share this post


Link to post
Share on other sites
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 );

 

 

Maureen, thanks for offering this solution. Unfortunately it didn't seem to work for me. Still doesn't seem to affect the database when I click the link. Did that code work for your site?

Share this post


Link to post
Share on other sites
Maureen, thanks for offering this solution. Unfortunately it didn't seem to work for me. Still doesn't seem to affect the database when I click the link. Did that code work for your site?

 

Just tested on two sites:

Purge 72, as changed, works on one but not the other -- isn't that strange

Truncate works on both

Delete all info from IP-Address works on both

Delete all records without session ID works on both

Purge all records of Guest Sessions is only on one and works

 

I was sure that the purge 72 worked on both but the one that won't work now is also the site that was moved to a new server and I am having other issues with the user_tracking on that site now (see my post above). Since I've emptied the user_tracking database from both sites, I'll have to wait to work on the purge 72 to see why it doesn't work on the one site. Maybe someone else will see the problem before that.

Share this post


Link to post
Share on other sites

It seems that all of asudden this module has stopped working on my site. I know it's not working because people have ordered from my site and it's not being logged in the User Tracking module. I am getting the orders, but it's not being tracked in teh User Tracking module. Strange?

 

Any ideas on what's going on?

 

Thanks,

 

Susan

Share this post


Link to post
Share on other sites

Haver installed the User tracker with admin on my store and it shows up in the admin panel and all but when i click on user tracking configuration I get this message:

 

Access Denied

 

No Right Permission Access

Please contact your Web Administrator to request

more access or if you found any problem.

Share this post


Link to post
Share on other sites
Haver installed the User tracker with admin on my store and it shows up in the admin panel and all but when i click on user tracking configuration I get this message:

 

Access Denied

 

No Right Permission Access

Please contact your Web Administrator to request

more access or if you found any problem.

 

Hi!

 

 

Im using osCMax so I have been very carefull not to let it replace any osCMax specific files with osCommerce ones and instead manually edited the osCMax files according to the install instructions file for the contribution. I have also implemented all modifications that relate to catalog/includes/footer.php in mainpage.php for the template I'm using since osCMax is BTS enabled.

 

Everything has worked fine and the contributions shows up in the admin panel and all but when I click on Configure user tracking I get the following error message in the admin panel.

 

Access Denied

 

No Right Permission Access

Please contact your Web Administrator to request

more access or if you found any problem.

 

 

Anyone have an idea as to what could be wrong?

Share this post


Link to post
Share on other sites

Do you have any Admin Access/Admin Levels contributions installed? This is the type of warning you would get if you did not set the new files in that type of contributions' administration control.

Edited by Maureen

Share this post


Link to post
Share on other sites
Do you have any Admin Access/Admin Levels contributions installed? This is the type of warning you would get if you did not set the new files in that type of contributions' administration control.

 

Yes I have and I have fixed it, Had to alowe the new admin box first...

Share this post


Link to post
Share on other sites

Maureen, Have you had a chance to discover anything new regarding the purge 72 problem?

Share this post


Link to post
Share on other sites
Maureen, Have you had a chance to discover anything new regarding the purge 72 problem?

 

Hoping to check it this weekend. Been trying to find the source of a $messageStack-->add_session problem while using the Register Globals contrib :'( but think I need to let it rest and hope someone can answer my post in that thread. Trying to be one step ahead of my host :blink:

Share this post


Link to post
Share on other sites

I found this odd; the original "delete from" code didn't work for some people so there were changes made (somewhere in this thread from long ago) which I used and they worked on the three sites I manage. These were the changes I suggested to try a few posts ago and then found that on one site they were no longer working. I now have the following code [which I believe is original from the script] on all sites plus a test site and the database is updated correctly for each operation.

 

From admin/user_tracking.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>';
  }

Share this post


Link to post
Share on other sites

That original code is the code that does not seem to work on my site. I cut and pasted back in the 72 hr part but nothing happens as before. <_<

Share this post


Link to post
Share on other sites

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

 

This has dramitically incresed the speed of the user tracking. I only have one issue. I no longer see the host names. I only see the ip for both ip and host name.

 

Did I miss something??

 

Thanks


-Dave

Share this post


Link to post
Share on other sites
<? //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 ?>

 

This has dramitically incresed the speed of the user tracking. I only have one issue. I no longer see the host names. I only see the ip for both ip and host name.

 

Did I miss something??

 

Thanks

 

You probably did...

Read and follow the bold part of my post as well...

Share this post


Link to post
Share on other sites

dr_lucas, thanks for the reply. I've tried both my primary and secondary name server IP's, and various timeouts...

 

Are there any changes to the file other than what is in the //bof to //eof section above?

 

I still only get ip's for the host name entries. The help is appreciated.

 

Thanks


-Dave

Share this post


Link to post
Share on other sites

Just noticed an error message on user_tracking.php

 

Warning: unpack(): Type c: not enough input, need 1, have 0 in /var/www/pti/admin/user_tracking.php on line 374

 

The code on 374 is:

// get segment size

$len = unpack("c", substr($response, $position));

 

would this have to do with why i am not seeing the hostnames?

 

just curious, I am not sure what that line does


-Dave

Share this post


Link to post
Share on other sites

wheres the edit button? silly

 

anyway, the error above is intermittent, ive only seen it twice out of many refreshes, FYI....


-Dave

Share this post


Link to post
Share on other sites

hello .

 

I installed the last version, but i get this error when I try to open Admin -> Reports ->

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /testshop/admin/includes/functions/database.php:13) in /testshop/admin/includes/functions/database.php on line 13

 

any ideea how to fix that ?!

 

Help ?!?!

Edited by zergu_ro

Share this post


Link to post
Share on other sites

Did anyone ever figure out the problem with the speed enhancement code and getting the "host" name to display?

 

I replaced the code as mentioned above and substituted the DNS IP address and tried various timeout values - but only the IP of the host is displayed.

Share this post


Link to post
Share on other sites

Do I have to press those purge buttons like once a week or something? Don want my database to fill 100mt of sessions...

 

I cant see where the visitors has come to my site, is this normal? I thought I could see with this contrubution that info too.

Edited by aapinen

Share this post


Link to post
Share on other sites

The admin interface is great for looking at visitor information over a 24 hour period.

 

I would like to know if anybody has added a function to export the information stored in the table "user_tracking".

 

I can export the table through phpMyAdmin, however I have a small problem here - Can anybody explain how to convert the "time_entry" field data from the 10 digit (eg 1157115243) into a proper date / time?

 

Many thanks and best regards,

Share this post


Link to post
Share on other sites

Hi,

 

Has anyone come across this type of outtput in User Tracking before, showing the user alledgedy returning to the home page between each click - obviously they aren't, but the page impressions are ending up in the database, and a knock-on effect is that checkout information (in particular billing information) is lost.

 

user_tracking_problem.jpg

Can't see the image above? Try http://www.outtoplay.co.nz/images/user_tracking_problem.jpg

 

This is happening during a witnessed session (with the store owner). His PC has this issue, but another PC in his office does not - both running the same version of IE. One worrying thought is that there may be some tracking software running on his PC?

 

Thanks in advance.

 

Quentin

Edited by cube

Share this post


Link to post
Share on other sites
I can export the table through phpMyAdmin, however I have a small problem here - Can anybody explain how to convert the "time_entry" field data from the 10 digit (eg 1157115243) into a proper date / time?

 

Many thanks and best regards,

 

In answer to my own post, I received this advice from the OpenOffice forum for converting Unix timestamps to regular date / time formats:

 

Dates in spreadsheets are just numbers, counting days since a given null-date (Calc's default: 1899-12-30). You may format any number as date.

A1 having the epoch time, convert the seconds to days and add start of epoch:

=A1/86400+DATE(1970;1;1)

86400 is the number of seconds per day (24*60*60)

 

==============

 

You may involve another cell (-12 to +12) for adjustment:

=A1/86400+DATE(1970;1;1) +$Setup.$A$1

assuming A1 on a (hidden) sheet "Setup".

Or without extra cells:

Ctrl+F3

Name: GMT_Offset

Refers to: 1 [=Central European Time]

Button "Add", "OK"

=A1/86400+DATE(1970;1;1) +GMT_Offset

"Named ranges" can refer to numbers, strings, formulae and relative ranges.

I prefer the term "named references".

Well, there might be some way for calculating daylight saving times as well. This would require some lookup in an extra table of countries.

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  

×