View Single Post
  #10  
Old 09-23-2005, 03:42 AM
 
hamid hamid is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 107
 

Default

Well, I had a look at an old x-cart distributive (v4.0.9), and it seems that x-cart changed stats.php slightly from 4.0.14 onwards (I think) - and you are right, the part of the code you need to change is not there.

I dont know enough about php to be able to tell you what to change to in your version of stats.php to get this mod to work - but I can suggest a couple of things that you can try.

First thing to try is, in Users_online> stats.php - forget about the first part of the mod for that file, and just apply the second part of the mod instead, ie:

Find:

Code:
*********************************************** $rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"]; $statistics[] = $rec; *********************************************** And change it to: *********************************************** $rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"]; $rec['session_ip'] = $data['session_ip']; $statistics[] = $rec; ***********************************************

Change all the other files according to the instructions for the rest of the mod, upload, clear templates cache, and test to see if that works.

If that doesn't work, then the only thing I can suggest is you could try to replace your stats.php with the modified one from 4.0.14 and see if that works.

So change your stats.php file to this:

Code:
*********************************************** if ( !defined('XCART_SESSION_START') ) { header("Location: error_message.php?permission_denied"); die("Access denied"); } $sesses = func_query("SELECT sessid, is_registered, expiry FROM $sql_tbl[users_online] WHERE usertype = 'C'"); $statistics = array(); if($sesses) { foreach($sesses as $s) { $data = array(); if ($use_sessions_type == 3 || $use_sessions_type == 2) { $data = func_query_first("SELECT data FROM $sql_tbl[sessions_data] WHERE sessid = '$s[sessid]'"); } elseif ($use_sessions_type == 1) { $old_sessid = $XCARTSESSID; x_session_id($s['sessid']); x_session_start($s['sessid']); $vars = array("login", "login_type", "cart", "current_date", "current_url_page", "session_create_date", "session_ip"); $data = array("data" => array()); $_s = array(); foreach ($vars as $v) { $_s[$v] == $$v; x_session_register($v); $data['data'][$v] = $$v; } x_session_id($old_sessid); x_session_start($old_sessid); foreach ($vars as $v) { x_session_register($v); $$v == $_s[$v]; } } if(empty($data['data'])) continue; $rec = array("last_date" => $s['expiry']); if ($use_sessions_type == 3) { $data = unserialize($data['data']); } elseif ($use_sessions_type == 2) { $tmp = explode("|", $data['data']); $data = array(); $last_name = array_shift($tmp); foreach ($tmp as $k => $v) { if (($pos = strrpos($v, ";")) === false) break; $pos2 = strrpos($v, "}"); if ($pos2 > $pos) $pos = $pos2; $data[$last_name] = unserialize(substr($v, 0, $pos+1)); $last_name = substr($v, $pos+1); } } elseif ($use_sessions_type == 1) { $data = $data['data']; } if(!empty($data['login']) && $data['login_type'] != 'C') continue; if(!empty($data['login'])) $rec['userinfo'] = func_userinfo($data['login'], 'C'); if(!empty($data['cart']['products'])) $rec['products'] = $data['cart']['products']; $rec['current_date'] = $data['current_date']+$config["General"]["timezone_offset"]; $rec['current_url_page'] = $data['current_url_page']; $rec['session_create_date'] = $data['session_create_date']+$config["General"]["timezone_offset"]; $rec['session_ip'] = $data['session_ip']; $statistics[] = $rec; } } ***********************************************

To be honest, if the first method (above) didn't work, then I wouldn't have high hopes that this latter method will work, but it's definitely worth a try - just make sure you have a backup of your files in case it doesn't work and you need to revert.

To MythNReality: the code in auth.php is there in v4.0.9, so it should be there in 4.0.12 as well. Just search for 'Users_online' in your copy of auth.php - there is only one instance of it in the whole of the file, so the code you are looking for should be right there (unless you've modified your auth.php and somehow gotten rid of it - if you have an unmodified copy of auth.php do a search in that and see if it's there).

I hope this helps!
Reply With Quote