
Originally Posted by
RodG
Instead of using ZenCarts' HTTP_SERVER CONSTANT, try using one of the Global variables.
$_SERVER['HTTP_HOST']
or
$_SERVER['SERVER_NAME']
Cheers
RodG
That won't work, because that will give you the admin $_SERVER['HTTP_HOST'].
I have the solution down below, but it involves some code changes.
First add a field to the Who's online table:
then open the file includes\functions\whos_online.php
find:
PHP Code:
if ($stored_customer->fields['count'] > 0) {
$sql = "update " . TABLE_WHOS_ONLINE . "
set customer_id = '" . (int)$wo_customer_id . "',
full_name = '" . zen_db_input($wo_full_name) . "',
ip_address = '" . zen_db_input($wo_ip_address) . "',
time_last_click = '" . zen_db_input($current_time) . "',
last_page_url = '" . zen_db_input($wo_last_page_url) . "',
host_address = '" . zen_db_input($_SESSION['customers_host_address']) . "',
user_agent = '" . zen_db_input($wo_user_agent) . "'
where session_id = '" . zen_db_input($wo_session_id) . "' and ip_address='" . zen_db_input($wo_ip_address) . "'";
$db->Execute($sql);
} else {
$sql = "insert into " . TABLE_WHOS_ONLINE . "
(customer_id, full_name, session_id, ip_address, time_entry,
time_last_click, last_page_url, host_address, user_agent )
values ('" . (int)$wo_customer_id . "', '" . zen_db_input($wo_full_name) . "', '"
. zen_db_input($wo_session_id) . "', '" . zen_db_input($wo_ip_address)
. "', '" . zen_db_input($current_time) . "', '" . zen_db_input($current_time)
. "', '" . zen_db_input($wo_last_page_url)
. "', '" . zen_db_input($_SESSION['customers_host_address'])
. "', '" . zen_db_input($wo_user_agent)
. "')";
$db->Execute($sql);
and change to:
PHP Code:
if ($stored_customer->fields['count'] > 0) {
$sql = "update " . TABLE_WHOS_ONLINE . "
set customer_id = '" . (int)$wo_customer_id . "',
full_name = '" . zen_db_input($wo_full_name) . "',
ip_address = '" . zen_db_input($wo_ip_address) . "',
time_last_click = '" . zen_db_input($current_time) . "',
last_page_url = '" . zen_db_input($wo_last_page_url) . "',
host_address = '" . zen_db_input($_SESSION['customers_host_address']) . "',
user_agent = '" . zen_db_input($wo_user_agent) . "',
store_address = '" . zen_db_input($_SERVER['HTTP_HOST']) . "'
where session_id = '" . zen_db_input($wo_session_id) . "' and ip_address='" . zen_db_input($wo_ip_address) . "'";
$db->Execute($sql);
} else {
$sql = "insert into " . TABLE_WHOS_ONLINE . "
(customer_id, full_name, session_id, ip_address, time_entry,
time_last_click, last_page_url, host_address, user_agent, store_address )
values ('" . (int)$wo_customer_id . "', '" . zen_db_input($wo_full_name) . "', '"
. zen_db_input($wo_session_id) . "', '" . zen_db_input($wo_ip_address)
. "', '" . zen_db_input($current_time) . "', '" . zen_db_input($current_time)
. "', '" . zen_db_input($wo_last_page_url)
. "', '" . zen_db_input($_SESSION['customers_host_address'])
. "', '" . zen_db_input($wo_user_agent)
. "', '" . zen_db_input($_SERVER['HTTP_HOST'])
. "')";
$db->Execute($sql);
Next open YOUR_ADMIN\whos_online.php
around line 158 find:
PHP Code:
$sql = "select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, session_id, host_address, user_agent
change to:
PHP Code:
$sql = "select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, session_id, host_address, user_agent, store_address
find:
PHP Code:
$lastURLlink = '<a href="' . zen_output_string_protected($whos_online->fields['last_page_url']) . '" target="_blank">' . '<u>'. zen_output_string_protected($whos_online->fields['last_page_url']) . '</u>' . '</a>';
change to:
PHP Code:
$lastURLlink = '<a href="' . zen_output_string_protected($whos_online->fields['last_page_url']) . '" target="_blank">' . '<u>' . zen_output_string_protected($whos_online->fields['store_address']) . zen_output_string_protected($whos_online->fields['last_page_url']) . '</u>' . '</a>';