Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Who's Online Enhancement 1.4


Guest

Recommended Posts

TROUBLESHOOTING

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

1. If your carts don't display, check the setting of STORE_SESSIONS in both includes/configure.php and admin/includes/configure.php. They should match. If not, carts will not display.

 

Hi,

 

For several reasons I must keep my catalog sessions in default and admin stored in mysql, so they don't match, but other user tracking contributions show the visitors cart just fine except for this one which requires the STORE_SESSION match.

Why is it required?

Is there any workaround to make it work without this requirement?

Link to comment
Share on other sites

ok, I fixed that annoyance myself.

If anybody STORE_SESSIONS set to default in catalog side and STORE_SESSIONS set to mysql in admin do this:

 

Find:

if (STORE_SESSIONS == 'mysql') {
  $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'");
  $session_data = tep_db_fetch_array($session_data);
  $session_data = trim($session_data['value']);
} else {
  if ((file_exists(tep_session_save_path() . '/sess_' . $session_id)) && (filesize(tep_session_save_path() . '/sess_' . $session_id) > 0)) {
	$session_data = file(tep_session_save_path() . '/sess_' . $session_id);
	$session_data = trim(implode('', $session_data));
  }
}




And replace with:
/*
if (STORE_SESSIONS == 'mysql') {
  $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'");
  $session_data = tep_db_fetch_array($session_data);
  $session_data = trim($session_data['value']);
} else {
  if ((file_exists(tep_session_save_path() . '/sess_' . $session_id)) && (filesize(tep_session_save_path() . '/sess_' . $session_id) > 0)) {
	$session_data = file(tep_session_save_path() . '/sess_' . $session_id);
	$session_data = trim(implode('', $session_data));
  }
}
*/

if ((file_exists(tep_session_save_path() . '/sess_' . $session_id)) && (filesize(tep_session_save_path() . '/sess_' . $session_id) > 0)) {
	$session_data = file(tep_session_save_path() . '/sess_' . $session_id);
	$session_data = trim(implode('', $session_data));
  }






Find:
if (STORE_SESSIONS == 'mysql') { 
  $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'");
  $session_data = tep_db_fetch_array($session_data);
  $session_data = trim($session_data['value']);
} else {
  if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) {
	$session_data = file(tep_session_save_path() . '/sess_' . $info);
	$session_data = trim(implode('', $session_data));
  }
}



And replace with:
  /*
if (STORE_SESSIONS == 'mysql') { 
  $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'");
  $session_data = tep_db_fetch_array($session_data);
  $session_data = trim($session_data['value']);
} else {
  if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) {
	$session_data = file(tep_session_save_path() . '/sess_' . $info);
	$session_data = trim(implode('', $session_data));
  }
}
*/

if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) {
	$session_data = file(tep_session_save_path() . '/sess_' . $info);
	$session_data = trim(implode('', $session_data));
  }

 

Done.

Link to comment
Share on other sites

Actually, here is an even more elegant solution, not just a workaround:

 

Find:

if (STORE_SESSIONS == 'mysql') {
  $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'");
  $session_data = tep_db_fetch_array($session_data);
  $session_data = trim($session_data['value']);
} else {
  if ((file_exists(tep_session_save_path() . '/sess_' . $session_id)) && (filesize(tep_session_save_path() . '/sess_' . $session_id) > 0)) {
	$session_data = file(tep_session_save_path() . '/sess_' . $session_id);
	$session_data = trim(implode('', $session_data));
  }
}

 

Replace with:

// First we check if the session exist in a file, else we will use mysql
if ((file_exists(tep_session_save_path() . '/sess_' . $session_id)) && (filesize(tep_session_save_path() . '/sess_' . $session_id) > 0)) {
	$session_data = file(tep_session_save_path() . '/sess_' . $session_id);
	$session_data = trim(implode('', $session_data));
  } else {
			 $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $session_id . "'");
			 $session_data = tep_db_fetch_array($session_data);
			 $session_data = trim($session_data['value']);
  }

 

 

 

 

 

 

Find:

	if (STORE_SESSIONS == 'mysql') {
  $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'");
  $session_data = tep_db_fetch_array($session_data);
  $session_data = trim($session_data['value']);
} else {
  if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) {
	$session_data = file(tep_session_save_path() . '/sess_' . $info);
	$session_data = trim(implode('', $session_data));
  }
}

 

Replace with:

// First we check if the session exist in a file, else we will use mysql
if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) {
	$session_data = file(tep_session_save_path() . '/sess_' . $info);
	$session_data = trim(implode('', $session_data));
  } else {
  $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'");
  $session_data = tep_db_fetch_array($session_data);
  $session_data = trim($session_data['value']);
}

Edited by dr_lucas
Link to comment
Share on other sites

for the last version Who's Online Enhancement 3.5.5 Full + IP Address geolocation + Visitors World Map

i had an error if you got php the fonction simplexml doesnt exsit it s in php5

 

you can download a class over there simplexml44 - PHP4 backport of PHP5 SimpleXML

 

then put it in admin/ functions

and call it like this :

require_once(DIR_WS_FUNCTIONS . 'simplexml/class/IsterXmlSimpleXMLImpl.php');

 

Because it's not possible to use the PHP5 ArrayIterator interface with PHP4 there are some differences between this implementation and that of PHP5:

* The access to the root node has to be explicit in IsterXmlSimpleXMLImpl, not implicit as with PHP5. Write $doc->root->node instead of $doc->node

 

*

You cannot access CDATA using array syntax. Use methods CDATA() and setCDATA() instead.

 

*

You cannot access attributes directly with array syntax. Always use attributes() to read and setAttribute() to write attributes.

 

*

Comments are ignored.

 

*

Last and least, this is not as fast as PHP5 SimpleXML--it's pure PHP4.

 

give me some feedback please

MS2

Link to comment
Share on other sites

strange even with included the php4 class i got

 

Fatal error: Cannot instantiate non-existent class: simplexmlelement in v:\easyphp\www\ms2fr\shop\admin\whos_online.php

MS2

Link to comment
Share on other sites

Hi all,

 

I have just installed 3.5.5 but I see no customer markers on the Google map; has anyone else had a similar problem?

 

Cheers,

Paul

 

I had it too .... what you have to do is this .... the step where you put your domain in, you have to put in full path to the visitors_georss.php file. That should fix it.

Link to comment
Share on other sites

I had it too .... what you have to do is this .... the step where you put your domain in, you have to put in full path to the visitors_georss.php file. That should fix it.

 

Hi Michael,

 

I am gonna give this a go later tonight; thank you very much for your reply. I'll let ya know how I got on.

 

Cheers,

Paul

Link to comment
Share on other sites

Hi Michael,

 

I am gonna give this a go later tonight; thank you very much for your reply. I'll let ya know how I got on.

 

Cheers,

Paul

 

 

NP Paul .... hope that helps you.

 

 

Just in case, an example .....

 

3)In the text you pasted at 2), replace

 

geoXml = new GGeoXml("<?php echo "http://www.example.com/catalog/admin/visitors_georss.php";?>");

 

with your domain

Link to comment
Share on other sites

I just tested 3.5.5 on my sandbox site and have a problem. I previously had 3.5.4 running smoothly. The instructions said "Simply run mod.sql and upload files to the admin directory" which I did. The page loads fine with zero activity but as soon as I view any page the following error(s) appear after a slightly longer than usual page reload.

Warning: file_get_contents(http://ipinfodb.com/ip_query2.php?ip=<my IP>): failed to open stream: Connection refused in /home/www/<mydomain>.com/_shop_Sandbox/admin/whos_online.php on line 120

 

Warning: file_get_contents(http://backup.ipinfodb.com/ip_query2.php?ip=<my IP>): failed to open stream: Connection refused in /home/www/<mydomain>.com/_shop_Sandbox/admin/whos_online.php on line 124

 

Fatal error: Cannot instantiate non-existent class: simplexmlelement in /home/www/<mydomain>.com/_shop_Sandbox/admin/whos_online.php on line 125

I tried a file content search for "simplexmlelement" and drew a blank so wondered if an includes/functions file is missing from the download.

 

I tried a copy/paste of http://ipinfodb.com/ip_query2.php?ip=<my IP> into the browser and get the following.

 

<Locations>

<Location id="0">

<Ip><my IP></Ip>

<Status>OK</Status>

<CountryCode>GB</CountryCode>

<CountryName>United Kingdom</CountryName>

<RegionCode/>

<RegionName/>

<City/>

<ZipPostalCode/>

<Latitude>54</Latitude>

<Longitude>-2</Longitude>

<Gmtoffset>0.0</Gmtoffset>

<Dstoffset>1.0</Dstoffset>

</Location>

</Locations>

 

I have not yet added the Visitors Map, just uploaded the content of the 3.5.5 download.

 

Any suggestions anyone?

 

Paul.

Link to comment
Share on other sites

I just tested 3.5.5 on my sandbox site and have a problem. I previously had 3.5.4 running smoothly. The instructions said "Simply run mod.sql and upload files to the admin directory" which I did. The page loads fine with zero activity but as soon as I view any page the following error(s) appear after a slightly longer than usual page reload.

 

I tried a file content search for "simplexmlelement" and drew a blank so wondered if an includes/functions file is missing from the download.

 

I tried a copy/paste of http://ipinfodb.com/ip_query2.php?ip=<my IP> into the browser and get the following.

 

 

 

I have not yet added the Visitors Map, just uploaded the content of the 3.5.5 download.

 

Any suggestions anyone?

 

Paul.

 

What version of PHP are you running? simplexmlelement is a PHP 5.0+ function (http://us2.php.net/manual/en/function.simplexml-element-attributes.php)

 

A solution to this problem was listed on the 9th by azer.

Edited by MichaelB
Link to comment
Share on other sites

What version of PHP are you running? simplexmlelement is a PHP 5.0+ function (http://us2.php.net/manual/en/function.simplexml-element-attributes.php)

 

A solution to this problem was listed on the 9th by azer.

I just looked and it is 4.4.2 so I guess I am out of luck.

 

I checked the 'fix' and it look way beyond my ability. I have dabbled with Ubuntu but the Sourceforge download contains a make file that immediately puts me off.

 

I guess I will stick with the old version.

 

Paul.

Link to comment
Share on other sites

All I get is:

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /xxxxxxxxxxxxxx/whos_online.php on line 125

 

As my host said told me, this uses a well known, well exploited security issue, and CURL should be used instead to fetch data.

Is there any plan to upgrade this contribution to use curl instead ?

Link to comment
Share on other sites

NP Paul .... hope that helps you.

 

 

Just in case, an example .....

 

3)In the text you pasted at 2), replace

 

geoXml = new GGeoXml("<?php echo "http://www.example.com/catalog/admin/visitors_georss.php";?>");

 

with your domain

 

 

Hi Michael,

 

I have my domain inserted into the line you pointed me towards in "admin/whos_online.php", but I am still seeing no markers on the map; I have also checked to ensure that my domain is entered correctly in the two defines at the top of "visitors_georss.php".

 

Do you have any other ideas as to what might be preventing this from working correctly?

 

Cheers,

Paul

Link to comment
Share on other sites

Weird SQL error since applying 3.5.5 with the IP Address GeoLocation and still exists with version 3.5.8 posted yesterday. It seems that when someone is online and has a region_name with an apostrophe (or maybe some other special characters like a dash as shown below) in it, the below error is issued. Any help would be appreciated to get the query to allow some of these special characters. Thanks in advance!

 

We are running PHP 5.2.8 and MySQL of 5.0.81

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Azur', `city` = 'Mougins', `latitude` = '43.6', `longitude` = '7' WHERE `ip_add' at line 1

UPDATE `whos_online` SET `country_code` = 'FR',`country_name` = 'France', `region_name` = 'Provence-Alpes-Cote d'Azur', `city` = 'Mougins', `latitude` = '43.6', `longitude` = '7' WHERE `ip_address` = '193.252.149.13'

Link to comment
Share on other sites

Hi Michael,

 

I have my domain inserted into the line you pointed me towards in "admin/whos_online.php", but I am still seeing no markers on the map; I have also checked to ensure that my domain is entered correctly in the two defines at the top of "visitors_georss.php".

 

Do you have any other ideas as to what might be preventing this from working correctly?

 

Cheers,

Paul

Hi Paul

 

I have just had the same problem as you - after much messing around I ended up with the following settings which seemed to work:

 

the file visitors_georss.php is in the catalog root not the admin folder - in that file I now have

define('FLAGSDIR', 'images/flags/');
define('HTTPSERVER', 'http://domain.co.uk/');
define('WEBSITE', 'http://domain.co.uk/');

My Google API key is for the domain root - http://domain.co.uk

 

in the file admin/whos_online.php the head looks like:

 

    <title><?php echo TITLE; ?></title>
   <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
   <script type="text/javascript" language="javascript" src="includes/general.js"></script>
<?php
if ($_GET['map'] != 'show'){
?>
</head>
<body>
<?php
} else {
?>
<!-- Mimic Internet Explorer 7 -->
 	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
   <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAGAk9wthOHAg5utZzp7SMLhTVdhbrmG7g7qE2XB2I-_2d7qrPUxQqBFxKcLKl0HTEBigDqMdXsU5QJg"
           type="text/javascript"></script>
   <script type="text/javascript">
   var map;
var geoXml;
var toggleState = 1;

function initialize() {
  if (GBrowserIsCompatible()) {
	geoXml = new GGeoXml("<?php echo "http://domain.co.uk/visitors_georss.php";?>");
	map = new GMap2(document.getElementById("map_canvas"));
	map.setCenter(new GLatLng(36,2), 1); 
	map.addControl(new GLargeMapControl());
	map.addControl(new GLargeMapControl());
	map.addOverlay(geoXml);
  }
}
   </script>


 </head>
 <body onLoad="initialize()" onUnload="GUnload()">

Link to comment
Share on other sites

Ooops - unable to edit the above....

 

Ok this gives me the markers on the Google Map - problem is it also shows the Google Map visiting the site with the IP 72.14.193.5 and the last page visited as /visitors_georss.php

 

In the database the Google map is getting a session_id so is visible in the whos_online table

 

I can exclude the Ip 72.14.193.5 with a little php if() statement.

 

However I am also seeing a visit from Googlebot on 66.249.71.2 - Googlebot is in the includes/spiders.txt file - excluding/including bots makes no difference to this one.

 

Obviously I have done something wrong somewhere that I cannot spot - any clues?

 

Thanks

 

Graeme

Edited by sakwoya
Link to comment
Share on other sites

Hi all - solved my above problem

 

If, like me, you have downloaded 3.5.9 you will only have the admin files - there is a missing file and some SQL statements.

 

To fix this download 3.5.4 by SteveDallas and copy the file catalog/includes/functions/whos_online.php to your store. Then run the following in your phpMyadmin:

 

ALTER TABLE whos_online ADD http_referer VARCHAR(255) NOT NULL;

ALTER TABLE whos_online ADD user_agent VARCHAR(255) NOT NULL;

ALTER TABLE `whos_online` ADD `hostname` VARCHAR( 255 ) NOT NULL AFTER `ip_address` ;

 

This fixed it for me.

 

Graeme

 

(I have an updated package but the contribution page is refusing to let me upload at the present time)

Link to comment
Share on other sites

(I have an updated package but the contribution page is refusing to let me upload at the present time)

 

I see that 3.6 has now been uploaded overnight so I am not going to upload my 3.5.9.1 as this basically means splitting the contribution and when these things fork they get all stupid.

 

If your admin page does not show the http_refrerer or user agent then follow my suggestions above

 

Graeme

Link to comment
Share on other sites

Seems one of the flag images is missing in the images folder for a country called "reserved". When a user comes on with the "reserved" in the country, the big red x missing image appears. Did I miss this in the upload or is this actually missing?We are on the latest version 3.6.1.

Link to comment
Share on other sites

i've just upgraded to 3.6 from 3.5.4 and i no longer see when people come to visit the site. any one having this problem?

 

I am having the same problem. The map shows up, no errors but it does not show when anyone is online. Does anyone know what the problem could be?

Link to comment
Share on other sites

Would there be a way to capture the information of who's online and create a listing of everyone who has visited the site for the past 30 days or a user selectable time frame? Maybe also to have it so the map gets cluttered with dots of where people have visited from the past (user selectable days).

Thanks,

Rob

Link to comment
Share on other sites

I'm getting a fatal error:

Fatal error: Cannot instantiate non-existent class: simplexmlelement in /var/www/shop/admin/whos_online.php

and

Fatal error: Call to undefined function: stripos() in /var/www/shop/admin/includes/functions/whos_online.php on line 153

I'm upgrading from v3.5.4 to v3.6.3, using PHP Version 4.4.6.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...