Results 1 to 10 of 15

Threaded View

  1. #7
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Adding HTTP_SERVER to who's online

    Quote Originally Posted by RodG View Post
    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:
    Code:
    ALTER TABLE `whos_online`  ADD `store_address2` TEXT NOT NULL ;
    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>'
    Last edited by Design75; 4 Jan 2014 at 04:47 PM.

 

 

Similar Threads

  1. Who's Online
    By SaMortensen in forum General Questions
    Replies: 8
    Last Post: 19 May 2008, 04:04 PM
  2. Who's Online
    By qisahn in forum General Questions
    Replies: 5
    Last Post: 25 Sep 2007, 03:47 PM
  3. Who's Online - User gone, but Admin says online
    By johnd in forum General Questions
    Replies: 2
    Last Post: 23 Sep 2007, 01:57 AM
  4. Who is online...side admin vs online group pricing mod
    By csfound in forum General Questions
    Replies: 8
    Last Post: 18 Jul 2007, 04:27 AM
  5. Who's Online
    By TecBrat in forum General Questions
    Replies: 1
    Last Post: 2 Jun 2006, 08:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg