Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Who's Online Enhancement 1.4


Guest

Recommended Posts

ive upgraded from 1.9 today to 3.4

 

everything seems to work BUT it takes around 2 min for 3.4 to actually load.

 

anyone else know why this would take so long to load?

 

I have a feature enhancement that will be useful to you or anybody else having hangups on IP lookups.

 

put this code in the configuration section of /admin/whos_online.php

 

 // mjc mike challis speed mod (added option to disable mass ip lookups that hang on some busy systems)
 $mass_lookup_ip = false; // <= set to true to enble, false to disable

 

find this code:

    if ($whos_online['ip_address'] == 'unknown') {
     $hostname = $whos_online['ip_address'];
   } else {
     $hostname = gethostbyaddr($whos_online['ip_address']);
   }

 

replace with this code:

    if ($whos_online['ip_address'] == 'unknown') {
     $hostname = $whos_online['ip_address'];
   } else {
     # mjc speed mod (added option to disable mass ip lookups that hang on some busy systems)
     $hostname = $whos_online['ip_address'];
     $mass_lookup_ip and $hostname = gethostbyaddr($whos_online['ip_address']);
   }

Link to comment
Share on other sites

I did a quick search and scan of this topic and I didnt see the resolution to the following problem.

 

When one of the visitors has an item in their cart, every "customer" has the Active with Cart or Inactive with Cart icon.

 

I did see that some with the same problem had different info here in the config files, but mine are both set to mysql.

 

Did I miss the resolution? I had hoped that downloading the newest contrib would help with this issue but it hasnt, I am not quite sure exactly where that particular problem lies.

 

Thank you in advance for your assistance.

 

I have the fix for this bug in vers 3.4:

 

open the file /admin/whos_online.php for edit

 

find code inside function tep_check_cart:

    if ($length = strlen($session_data)) {
     if (PHP_VERSION < 4) {
       $start_id = strpos($session_data, 'customer_id[==]s');
       $start_cart = strpos($session_data, 'cart[==]o');
       $start_currency = strpos($session_data, 'currency[==]s');
       $start_country = strpos($session_data, 'customer_country_id[==]s');
       $start_zone = strpos($session_data, 'customer_zone_id[==]s');
     } else {
       $start_id = strpos($session_data, 'customer_id|s');
       $start_cart = strpos($session_data, 'cart|O');
       $start_currency = strpos($session_data, 'currency|s');
       $start_country = strpos($session_data, 'customer_country_id|s');
       $start_zone = strpos($session_data, 'customer_zone_id|s');
     }

     for ($i=$start_cart; $i<$length; $i++) {
       if ($session_data[$i] == '{') {
         if (isset($tag)) {
           $tag++;
         } else {
           $tag = 1;
         }
       } elseif ($session_data[$i] == '}') {
         $tag--;
       } elseif ( (isset($tag)) && ($tag < 1) ) {
         break;
       }
     }

     $session_data_id = substr($session_data, $start_id, (strpos($session_data, ';', $start_id) - $start_id + 1));
     $session_data_cart = substr($session_data, $start_cart, $i);
     $session_data_currency = substr($session_data, $start_currency, (strpos($session_data, ';', $start_currency) - $start_currency + 1));
     $session_data_country = substr($session_data, $start_country, (strpos($session_data, ';', $start_country) - $start_country + 1));
     $session_data_zone = substr($session_data, $start_zone, (strpos($session_data, ';', $start_zone) - $start_zone + 1));

     session_decode($session_data_id);
     session_decode($session_data_currency);
     session_decode($session_data_country);
     session_decode($session_data_zone);
     session_decode($session_data_cart);

     if (PHP_VERSION < 4) {
       $broken_cart = $cart;
       $cart = new shoppingCart;
       $cart->unserialize($broken_cart);
     }

     if (is_object($cart)) {
       $products = $cart->get_products();
     }
   }

 

replace with this code:

    # mjc mike challis bof added to fix shopping cart indicator bug
   # the bug was .. When one of the visitors has an item in their cart,
   # every "customer" has the Active with Cart or Inactive with Cart icon blinking.

   # big chunk of nonesense code deleted and replaced with this:

   $products =0;
   if ($length = strlen($session_data)) {
     #contents";a:0: <= no products in cart
     #contents";a:5: <= 5 products in cart
     preg_match('|contents";a:(\d+):|i',$session_data, $find);
     $products = $find[1];
   }
   # mjc mike challis eof added to fix shopping cart indicator bug

 

find this code:

    // Determine active/inactive and cart/no cart status
   // no cart
   if ( sizeof($products) == 0 ) {

 

replace with this code:

    // Determine active/inactive and cart/no cart status
   // no cart
   if ($products == 0 ) { # mjc modified to fix shopping cart indicator bug

 

do not modify the other similar code section at the bottom of the file!

 

Now the shopping cart indicator lights will work correctly :lol:

Link to comment
Share on other sites

Here is a feature enhancement to add wordwrap to HTTP Referrer URL

sometimes HTTP Referrer URL is very long and makes the pace scroll at the bottom

 

open the file /admin/whos_online.php for edit (3.4 was the latest at time I added)

 

find:

							<td class="smallText" colspan="9"><?php echo '<strong>' . TEXT_HTTP_REFERER_URL . ':</strong><a href="' . htmlspecialchars($http_referer_url) . '" target="_blank">' . htmlspecialchars($http_referer_url) . '</a>';

 

replace with

							<td class="smallText" colspan="9"><?php
						 # mjc mike challis added wordwrap to referrer url (change 150 to the number of chars you want before wrap)
						 echo '<strong>' . TEXT_HTTP_REFERER_URL . ':</strong> <a href="' . htmlspecialchars($http_referer_url) . '" target="_blank">' .
wordwrap(htmlspecialchars($http_referer_url), 150, "<br>", true) . '</a>'; ?></td>

Link to comment
Share on other sites

Hi,

 

I was just wondering if anyone could help. I am having issues with the Last_Page_Url functionality.

 

Whatever page a customer is currently viewing on our live site all that is displayed in who's online /stylesheet.php (we have a dynamic css).

 

Would someone be able to explain where the last_page is inserted into the whos_online table. I have looked at catalog/includes/functions/whos_online.php but $wo_last_page_url does not seem to be what's actually being stored in the db.

 

Apologies if this makes no sense.

 

Cheers.

Link to comment
Share on other sites

hey guys i keep getting the following error whenever my google products feedmachine starts (every 2 hours)

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /var/www/vhosts/enigmabunny.co.uk/httpdocs/admin/whos_online.php on line 414

any ideas??

Link to comment
Share on other sites

hey guys i keep getting the following error whenever my google products feedmachine starts (every 2 hours)

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /var/www/vhosts/enigmabunny.co.uk/httpdocs/admin/whos_online.php on line 414

any ideas??

 

This should not happen at all if you are using v3.3.2 or later. If you are using an earlier version, upgrade to v3.4. If you are using a current version, please browse the whos_online table in your shop database and PM the offending IP address to me. I'll get it sorted out for v3.5.

 

--Glen

Link to comment
Share on other sites

reinstall it

 

mine worked 1st time , great conrtibution

 

Mine's never worked, not from day one. I've updated every time a new version comes out too.

 

I can only think it's a problem with my hosts, 1and1, or my sessions set up. But no one has similar problems and therefore a solution..?

Thanks for any help/comments.

 

Regards,

 

Lewis Hill

Link to comment
Share on other sites

  • 2 weeks later...

I get this message when running the original whos_online page:

Fatal error: Maximum execution time of 30 seconds exceeded in ......./admin/whos_online.php on line 130

 

Some other people seem to get it also. Does anyone know why and what can be done to fix it. I recently changed servers from MYSQL4 PHP4 to MYSQL5 PHP5. Everything else works fine.

I had this problem as soon as I moved servers, but after a few days it seemed to go away on its own.

This morning (2 weeks on) the error appears again and causes problems with the whos_online page.

 

i've seen other posts from glen "It sounds as though you may have encountered a non-resolving IP address and your ISP has a limit on execution time of PHP scripts. Does it happen all the time, or just at certain times?"

and the upgrade to this contribution from Mike Challis

http://www.oscommerce.com/forums/index.php?s=&...t&p=1203264

 

Please can somebody confirm that i) this is probably due to a non-resolving IP address?

and ii) what is the best way to fix this problem?

Should I install this contribution and then the fix from Mike.

 

Please advise, this is driving me mad!

Link to comment
Share on other sites

I get this message when running the original whos_online page:

Fatal error: Maximum execution time of 30 seconds exceeded in ......./admin/whos_online.php on line 130

 

Some other people seem to get it also. Does anyone know why and what can be done to fix it. I recently changed servers from MYSQL4 PHP4 to MYSQL5 PHP5. Everything else works fine.

I had this problem as soon as I moved servers, but after a few days it seemed to go away on its own.

This morning (2 weeks on) the error appears again and causes problems with the whos_online page.

 

i've seen other posts from glen "It sounds as though you may have encountered a non-resolving IP address and your ISP has a limit on execution time of PHP scripts. Does it happen all the time, or just at certain times?"

and the upgrade to this contribution from Mike Challis

http://www.oscommerce.com/forums/index.php?s=&...t&p=1203264

 

Please can somebody confirm that i) this is probably due to a non-resolving IP address?

and ii) what is the best way to fix this problem?

Should I install this contribution and then the fix from Mike.

 

Please advise, this is driving me mad!

 

Yes I would try it. I have PHP5 and it works. (also works on PHP4)

Your timeout problem is probably due to a non-resolving IP address. Non-resolving IP address lookups are actually quite common. Some servers are setup with a long timeout.

 

I have the automatic ip address lookup feature turned off on my who's online page, you still see the IP addresses and if you really want to see the resolved IP, then click on the IP address link to do a lookup on that single IP. You have noting to lose by trying it. Just backup your current file in case.If you try it, please reply here, thanks.

Edited by CRUZN8R
Link to comment
Share on other sites

Okay installed ver 3.4 and it can't get anything to show up in the admin panel. Not even my own IP address when I am viewing my website. Any reason who this would not work at all? I get no errors

 

Does it show the totals as a bunch of zeros?

 

Did you set STORE_SESSIONS in catalog/admin/includes/configure.php? Does it match the value set in catalog/includes/configure.php?

 

Check your database using phpmyadmin (or other tool). Are there any rows in the whos_online table?

 

--Glen

Link to comment
Share on other sites

Does it show the totals as a bunch of zeros?

 

Did you set STORE_SESSIONS in catalog/admin/includes/configure.php? Does it match the value set in catalog/includes/configure.php?

 

Check your database using phpmyadmin (or other tool). Are there any rows in the whos_online table?

 

--Glen

 

Yeah just zeros.

 

Both configure files match with STORE_SESSIONS being set to 'mysql'

 

I did check the database whos_online table and there is no data in it.

Edited by JnJSpdShop
Link to comment
Share on other sites

Yeah just zeros.

 

Both configure files match with STORE_SESSIONS being set to 'mysql'

 

I did check the database whos_online table and there is no data in it.

 

It sounds as though you aren't populating the whos_online table.

 

Make sure that the following is in your store's includes/application_top.php file, and that it is not commented out. (These lines are from the standard osC installation.)

 

// include the who's online functions
 require(DIR_WS_FUNCTIONS . 'whos_online.php');
 tep_update_whos_online();

 

Also, be sure that you install the file includes/functions/whos_online.php from this contribution.

 

Let us know what you find.

 

--Glen

Link to comment
Share on other sites

I have moved to new server recently and installed this contribution.

 

Problem is that it does not work by default. I think I have tracked down the issue to session handling by my server. It seem to crypt session values because when I look at session table data is not readable (looks like base64 encoding but is not).

 

And because of that, script can't show basket content because it gets this data from session value and what's more, it gets into infinite loop in one place in script.

 

Loop can be fixed by adding:

      if ( $start_id === false ) $start_id = 0;
     if ( $start_cart === false ) $start_cart = 0;
     if ( $start_currency === false ) $start_currency = 0;
     if ( $start_country === false ) $start_country = 0;
     if ( $start_zone === false ) $start_zone = 0;

after:

        $start_id = strpos($session_data, 'customer_id|s');
       $start_cart = strpos($session_data, 'cart|O');
       $start_currency = strpos($session_data, 'currency|s');
       $start_country = strpos($session_data, 'customer_country_id|s');
       $start_zone = strpos($session_data, 'customer_zone_id|s');

 

but it does not fix missing basket. Can anyone think of some workaround for this issue? Can I somehow see real session data in my script?

Edited by fszone
Link to comment
Share on other sites

Hi Guys.

 

My install is working fine, so no problems there :)

 

However.... My host is complaining my site is using too much processing power on the server :( :(. So I'm wondering if there are any known issues along this line with this contrib. ?

 

Any help comments etc. will be welcomed please.

 

Thanks

 

Steve

____________________________________________________________________

____________________________________________________________________

Link to comment
Share on other sites

I get this message when running the original whos_online page:

Fatal error: Maximum execution time of 30 seconds exceeded in ......./admin/whos_online.php on line 130

 

Some other people seem to get it also. Does anyone know why and what can be done to fix it. I recently changed servers from MYSQL4 PHP4 to MYSQL5 PHP5. Everything else works fine.

I had this problem as soon as I moved servers, but after a few days it seemed to go away on its own.

This morning (2 weeks on) the error appears again and causes problems with the whos_online page.

 

i've seen other posts from glen "It sounds as though you may have encountered a non-resolving IP address and your ISP has a limit on execution time of PHP scripts. Does it happen all the time, or just at certain times?"

and the upgrade to this contribution from Mike Challis

http://www.oscommerce.com/forums/index.php?s=&...t&p=1203264

 

Please can somebody confirm that i) this is probably due to a non-resolving IP address?

and ii) what is the best way to fix this problem?

Should I install this contribution and then the fix from Mike.

 

Please advise, this is driving me mad!

 

Have you find a solution yet?

I have the same "time out error" (with this contribution), for 3 months it worked well and now without any changes I get the eror.

Link to comment
Share on other sites

Have you find a solution yet?

I have the same "time out error" (with this contribution), for 3 months it worked well and now without any changes I get the eror.

 

I will post a new version this weekend that should resolve all the timeout problems. In addition, it speeds up drawing of the who's online page, especially when you have non-resolving IP addresses among your visitors.

 

--Glen

Link to comment
Share on other sites

I will post a new version this weekend that should resolve all the timeout problems. In addition, it speeds up drawing of the who's online page, especially when you have non-resolving IP addresses among your visitors.

 

--Glen

 

I've got the same problem.

Have you allready post a new version?

I've searched the forum but can't find it nowhere. Thanks for your great job!!!

Link to comment
Share on other sites

I've got the same problem.

Have you allready post a new version?

I've searched the forum but can't find it nowhere. Thanks for your great job!!!

 

I got busy and didn't have the chance to post it. I will package it all up and make an announcement here when it is posted.

 

--Glen

Link to comment
Share on other sites

Have you find a solution yet?

I have the same "time out error" (with this contribution), for 3 months it worked well and now without any changes I get the eror.

 

This timeout problem is a real pain. It went away for about a month, then came back again yesterday. I finally installed the whosonline modification yesterday, but it DID NOT fix this timeout problem.

Today, though, the time out problem has gone again and the new whosonline page is working fine!

I can live with this problem because it only comes about once a month for a few days, but I would like to know what/who is causing the problem!!

 

Also, is there any instructions for this modification? I have an uptime checker on my website and I would like to remove, or identify it separately from bots and real customers.

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...