Jump to content

Recommended Posts

Three different names

  define('DIR_WS_ADMIN', 'ADMIN/');
  define('DIR_WS_HTTPS_ADMIN', '/ADDMIN/');
  define('DIR_FS_ADMIN', '/home/XXXX/public_html/AMIN/');

If the above are just typos, please rename the admin to admin for the test shop and change all references to it in the configure files to admin. Too much effort is being spent on what the true location is not to mention it is impossible to troubleshoot under those conditions.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

I have put everything in admin for "BS234FINAL" back to admin as requested.

 

Many thanks

Grandp

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

No, still the same Fatal error.

Ive tried googling but that hasn't come up with anything. Ive done another download of the addon and installed, still same Fatal error. Is there anything I could do with regards to say the DB (or just tolerate the error, at least I can see all he bots.)

 

Cheers

 

Grandp

Share this post


Link to post
Share on other sites

Unfortunately, I can't reproduce the error so I don't know what to suggest to fix it. I just tried testing it in two shops, one an old RC2 shop and one a BS shop. Both worked as expected. It may be something related to your setup or server but I've no way to know. You can try removing the code giving that error. That is not a fix but it may allow it to be useable to some extent. To do that, find this line in admin/includes/functions/view_counter.php

throw new Exception("invalid data, remaining: " . substr($session_data, $offset));

And replace it with

return array();

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack. Am running with your suggestion. All seems OK.

 

Thank you so much for your patience and help in trying to sort this. It was certainly extremely appreciated

I suspect it must be something to do with the server, as I installed a completely virgin copy of GOLD BS and the installed the addon and got the same error message, as soon as I applied your "fix" it seems to work OK.

 

Again, so many thanks for your help.

 

All the best

 

Kind regards

Grandpa

Share this post


Link to post
Share on other sites

Glad to hear it. Please let me know what php version is being used so I can try to duplicate the problem here.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

Using  PHP Version 5.4.45,(Zend: 2.4.0)  lets see what unfolds.

 

Again many thnaks for your help.

 

Kind regards

Grandp

Edited by grandpaj

Share this post


Link to post
Share on other sites

@@Jack_mcs

Hi Jack

 

Just wondering would this work;

/*******************************************************************************
Used to unserialize a sesssion - normal unserialze won't work
/******************************************************************************/
function unserialize_session($data) {
    $hasBuffer = isset($_SESSION_data);
    $hasBuffer && $buffer = $_SESSION_data;
    session_decode($data);
    $session = $_SESSION_data;
  // $hasBuffer ? $_SESSION_data = $buffer : unset($_SESSION_data);
    return $session_data;
}

/*******************************************************************************
Sort a multi array - data field must be named text
/******************************************************************************/

Instead of this

/*******************************************************************************
Used to unserialize a sesssion - normal unserialze won't work
/******************************************************************************/
function UnserializeSession($session_data) {
     $return_data = array();
     $offset = 0;
     while ($offset < strlen($session_data)) {
         if (!strstr(substr($session_data, $offset), "|")) {
   throw new Exception("invalid data, remaining: " . substr($session_data, $offset));
            }
         $pos = strpos($session_data, "|", $offset);
         $num = $pos - $offset;
         $varname = substr($session_data, $offset, $num);
         $offset += $num + 1;
         $data = unserialize(substr($session_data, $offset));
         $return_data[$varname] = $data;
         $offset += strlen(serialize($data));
     }
     return $return_data;    
}

/*******************************************************************************
Sort a multi array - data field must be named text

Cheers

Grandp

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

Had a go, didn't really work as it thru up this error, when in View Counter>Monitor>Visitors

Fatal error: Call to undefined function UnserializeSession() in /home/.../admin/includes/functions/view_counter.php on line 1318

which is

 $cartArray = UnserializeSession(trim($cart['value']));

Cheers

Grandp

Edited by Gergely
John asked to clear path

Share this post


Link to post
Share on other sites

You have to replace the first line in your code, function..., with the original one.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

The following code seems to work, or at least it doesn't return any errors.Whether it is doing what the original code was supposed to do I wouldn't have a clue

 

Here's the code.Would appreciate your comments as to which should be used.

/*************************************************/
Used to unserialize a sesssion - normal unserialze won't work
/******************************************************************************/    
 function UnserializeSession($session_data) {    
  $hasBuffer = isset($_SESSION_data);
    $hasBuffer && $buffer = $_SESSION_data;
    session_decode($data);
    $session = $_SESSION_data;
  // $hasBuffer ? $_SESSION_data = $buffer : unset($_SESSION_data);
    return $session_data;
}

Cheers

Grandp

Edited by grandpaj

Share this post


Link to post
Share on other sites

Thanks for being a guinea pig. :) To test it, try clicking around the shop and add a product to the cart, with attributes if possible, and then see if the clicks show up in the monitor section, especially any products descriptions and attributes. Then click on the Kick button (you have to enable that option first) and switch back to the shop side to see if you have been kicked off (your cart should be empty). If that all works then the session code would appear to be working.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

(Im back)

 

Tried the code in post #388 but got this message

Warning: Illegal string offset 'cart' in /home/XXXX/public_html/Xadmin/includes/functions/view_counter.php on line 1320

The View Monitor still seemed to be working.

 

However I have gone back to the "old" code with the following "adjustment"

 //  throw new Exception("invalid data, remaining: " . substr($session_data, $offset));
       return array();         }

I have tried "kick off" seems to work - Pops up a message on the web site when I go back there.

However under View Monitor,  File Name ( -> shopping_cart.php) it tells me that the shopping cart is empty even although I have stuff in it. does show  me as being logged in.

 

Cheers

Grandpa

Share this post


Link to post
Share on other sites

Any Illegal string offset messages can usually be safely ignored, as mentioned previously. For the shopping cart contents, the session has to be readable which, in your case, it isn't for some reason, at least not in every case. The kick off option also needs to have the session so it seems to work for that. I'm assuming you are adding something to the cart and then looking at that line in the Monitor section. If the session expires, then nothing will show since the cart will be empty. Also, it might be worth turning off the recreate session id in configuration->Sessions just to see if that makes a difference.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

Im back,

On checking Report> IP Counts I get a heap of these but only after an extremely long report.(What I found was if I went into the DB and truncated the View_counter_storage the problem went away for a while until the IP Count report got very large again

 

Warning: Illegal string offset 'Country Code' in /home/XXXX/public_html/admin/includes/modules/view_counter/view_counter_report_ip_count.php on line 42

 

I know that you have said not to worry about these but there is a lot of them. Chould I just comment out line 42 and go without having any flags showing, or is there another "fix"

 

Hope this makes sense.

 

Many thanks

Grandpa

Edited by grandpaj

Share this post


Link to post
Share on other sites

There is a setting that allows you to clear the storage table. It defaults to two weeks. The main reason it takes so long is because the code isn't using pagination so it tries to load it all. I have that change on the todo list.

 

There is also a setting to turn the flag display off.

 

For the warnings, there's no reason to show those under normal conditions. In fact, allowing any to show on the shop side is a security issue. So I suggest that in both application_top files, find the error_reporting line near the top and place this after it

ini_set('display_errors','0'); 

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

I'm back

 

Just thought I'd update you on the "problem" I now have since post #393

I now get heaps of  the following in my admin error report

[03-Aug-2016 21:48:27 Pacific/Auckland] PHP Warning:  Illegal string offset 'Country Code' in /home/XXXXXXX/public_html/ADMIN/includes/modules/view_counter/view_counter_report_ip_count.php on line 42

Cheers

 

Grandpa

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

Yes, I did do as you suggested in your post regarding illegal offset warnings. (ini_set('display_errors','0')

 

What that did was get rid of the warnings which were appearing on admin/view_counter_reports.php page, now they seem to be appearing in the admin/error.php page. (maybe they were there before and I just hadn't checked)

However I can get rid of them if I manually truncate the view counter storage database.

I have the Forced reset storage in configuration set to 4

 

Cheers

Grandpa

Edited by grandpaj

Share this post


Link to post
Share on other sites

To be clear, the code I said to add goes in the application_top file. If you did that, it applies to all files that get loaded.

Share this post


Link to post
Share on other sites

@@Jack_mcs

Hi Jack

 

This is what Ive got in application_top.php

// set the level of error reporting
  error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors','0');

I now suspect maybe I should have commetted out line 2

 

Many thanks

Grandpa

Share this post


Link to post
Share on other sites

Ver. 1.6 of view_counter, running on OsC 2.3.4 with MySQL 5.5.50.

While testing the badbottrap (access from a browser on /view_counter_badbottrap) I realize, that the IP is not banned nor an email was send to the admin. Server log is showing this error:

PHP Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /mnt/XXX/a2/52/XXX/htdocs/XXX/includes/functions/database.php on line 104

The client IP is not registered in the database nor doesn't show up in the view_counter monitor. View_counter does show IP's and all information of visitors.

Configuration of view_counter:
    
ON/OFF     true     
Active Time     10     
Bad Bot Trap     Both     
Block Countries Shop     Internal     
Block Countries Allow Bots     On     
Countries Check Admin     Internal     
Date Format     %a, %D %T     
Force Reset     2     
Force Reset Storage     14     
Hide Admin Links         
Item Name Length     20     
Kick Off     false     
Page Refresh Period     120     
Rows Per Page     20     
Send Emails To         
Show Flags     true     
Show Account Details     true     
Version Checker     false        

What did I wrong - I carefully followed all steps in the install.txt.

Thank's for any help in advance,

stefan

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

×