PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Adding Internal & External IPs & UserName in list links

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding Internal & External IPs & UserName in list links

    hi all,

    We're using zoom for our knowledge base for more than 10 years and we're very pleased with your product.

    I need your help for adding the internal & external ips and the user name to every link when the search list is displayed.
    We use a protected by usr/psw directory option in cPanel (our site is in CENTOS 6.9) to identify every user.

    Actually, our error log shows the provided user name (usually saved on browser's cache) and external ip:
    78658:[Mon Apr 02 20:50:25.417592 2018] [auth_basic:error] [pid 9726:tid 140318355707648] [client xxx.xxx.xxx.xxx:49976] AH01618: user <usr-nam> not found: /kb/FileName.pdf, referer: http://mydomain.com/zoom/kb/search.php?zoom_sort=0&zoom_query=<keyword>&zoom_p er_page=10&zoom_and=1

    This is an example of the list link:
    http://www.mydomain.com/kb/FileName.pdf#search=%22<keyword>%22

    This is what I would like to see in error log instead:
    78658:[Mon Apr 02 20:50:25.417592 2018] [auth_basic:error] [pid 9726:tid 140318355707648] [client xxx.xxx.xxx.xxx:49976] AH01618: user <usr-nam> not found: /kb/FileName.pdf, referer: http://mydomain.com/zoom/kb/search.php?zoom_sort=0&zoom_query=<keyword>&zoom_p er_page=10&zoom_and=1&code=d892d12d:c0a80001:55736 5724e616d65

    In this example I'm asuming:
    $externalIP = file_get_contents("http://ipecho.net/plain"); got d892d12d (216.146.209.45)
    $localIP = getHostByName(getHostName()); got c0a80001 (192.168.0.1)
    $username = getenv("username"); got 557365724e616d65 (UserName)

    I wanna get addresses & user name's ascii code in hex in order to avoid hurting any feelings.

    Anyway, keep up the good work!

    br,
    cesar.

  • #2
    You can create a wrapper PHP page to search.php as described here:
    Q. How can I add server-side scripting (eg. PHP, ASP) to the search template?

    In which you can add any additional PHP code to the search form. You can also disable the auto generated search form if need be.

    Changing the results link would be more difficult. One option is using XML output and post processing the results.

    Another option is customizing the PHP search script. However, any changes to the search.php script would void support.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      hi Ray,

      Unfortunately, xml is out of my league... and I'm aware of the php search page problem, but right now I think it's my only option.

      I could use a little help from you, guiding me to the output generation function where you would attach the code.

      I'm planning to add just two lines there: 1) $location generation and 2)... . $location, in order to minimize maintenance issue you mentioned.

      I can share the code with you for anybody who could benefit from it.

      br,
      cesar

      Comment


      • #4
        hi,

        Here it is my beta code... now I'm only need to find the right place to add it:

        Code:
        [COLOR=#000080]$ExtItm = explode(".",file_get_contents("http://ipecho.net/plain"));
        $IntItm = explode(".",getHostByName(getHostName()));
        $WinUsr = getenv("username");
        $WinUsr = substr($WinUsr,0,strlen($WinUsr)-1);
        $WinArr = str_split($WinUsr);
        $WinItm = "";
        
        foreach ( $WinArr as $WinOrd ) { $WinItm = $WinItm . dechex(ord($WinOrd)); }
        
        $HexItm = dechex($ExtItm[0]) . dechex($ExtItm[1]) . dechex($ExtItm[2]) . dechex($ExtItm[3]) . ':'
                . dechex($IntItm[0]) . dechex($IntItm[1]) . dechex($IntItm[2]) . dechex($IntItm[3]) . ':'
                . $WinItm;
        
        echo $HexItm;[/COLOR]
        any help?

        Comment


        • #5
          Adding this isn't related to the functionality of the search engine itself, so we don't provide support for this.

          If you are pursuing customizing the search.php script, please be aware that a high level of familiarity and experience with PHP programming is required to ensure existing functionality is not broken. You may want to consider hiring an experienced developer if you are not sure.
          --Ray
          Wrensoft Web Software
          Sydney, Australia
          Zoom Search Engine

          Comment


          • #6
            update: this didn't worked, any attempt to ask browser for "internal" data was stuck with "security" and got no relevant data at all...

            Comment

            Working...
            X