Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions

You are not logged in.

Announcement

#1 2020-08-07 12:41:51

Jura
New member
Registered: 2020-08-07
Posts: 8

The IP address of the visitors is not displayed

Hello friend,
After the some update in mid - year 2017, LiveHelperChat stopped showing IP of visitors. Displays only 127.0.0.1 for each visitor.
I think I have everything allowed everywhere.
Does anyone have any experience with this problem?

Thank you for every answer.  smile

Offline

#2 2020-08-07 12:47:11

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: The IP address of the visitors is not displayed

Here all works. I don't have this problem...

Offline

#3 2020-08-07 12:57:05

Jura
New member
Registered: 2020-08-07
Posts: 8

Re: The IP address of the visitors is not displayed

Thanks for reply.
So should I try a total reinstall?

Offline

#4 2020-08-07 12:58:32

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: The IP address of the visitors is not displayed

I dot not think it would help. Try to write some script to check where is a problem...

Offline

#5 2020-08-07 13:23:42

Jura
New member
Registered: 2020-08-07
Posts: 8

Re: The IP address of the visitors is not displayed

I don't know how to test it by skript, I'm not a programmer :-(

Offline

#6 2020-08-07 14:19:16

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: The IP address of the visitors is not displayed

Well, not much I can do... Without having to login to server etc etc...

you can modify index.php and put under <?php

print_r($_SERVER);

And paste content there...

Offline

#7 2020-08-08 14:25:41

Jura
New member
Registered: 2020-08-07
Posts: 8

Re: The IP address of the visitors is not displayed

Hi Remdex,
I found something.
It worked last on PHP 5.6.40.
It stopped working on PHP 7.0.33 web hosting after migration.
I tried a new installation of LiveHelperChat on PHP 7.0.33 but still the same result.
All visitors have IP: 127.0.0.1   sad

Is it possible to do something about it?
Is there a problem with the new PHP features?

Offline

#8 2020-08-09 09:48:31

Jura
New member
Registered: 2020-08-07
Posts: 8

Re: The IP address of the visitors is not displayed

Here is the command response:  print_r($_SERVER);


Explanation:
*****  = It is anonymized private data

ECHO:

Array ( [HTTPS] => on [UNIQUE_ID] => ***
[PERL5LIB] => /usr/share/awstats/lib:/usr/share/awstats/plugins
[HTTP_HOST] => www.********.com [HTTP_X_REAL_IP] => 109.80.146.135
[HTTP_X_FORWARDED_PROTO] => https [HTTP_CONNECTION] => close [HTTP_CACHE_CONTROL] => max-age=0 [HTTP_UPGRADE_INSECURE_REQUESTS] => 1 [HTTP_USER_AGENT] => Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.170 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 [HTTP_ACCEPT_ENCODING] => gzip, deflate, br [HTTP_ACCEPT_LANGUAGE] => cs-CZ,cs;q=0.9 [HTTP_COOKIE] => _ga=GA1.2.717662616.1560057882; _gid=GA1.2.391026245.1596859933; PHPSESSID=88h22e08tvk29r39ne7tmu8u6m95rt0l; lhc_rm_u=uw0mpu2kpxyl6uzy23xdxvb5785gy%3A3%3A38a337704d3111bb546e8563e9ba64efe1332ede; lhc_per={%22vid%22:%22e10b717bace0fa84847d%22%2C%22hnh%22:%221596882085%22%2C%22ex%22:15979%2C%22lhc_hnh%22:%221597034792%22}; lhc_ses={%22hash_resume%22:%226_4e912c3439a34c9dd528e02491b3b7f210434797%22} [HTTP_X_FORWARDED_FOR] => 127.0.0.1 [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04
[SERVER_NAME] => www.******.com [SERVER_ADDR] => 127.0.0.2 [SERVER_PORT] => 80 [REMOTE_ADDR] => 109.80.146.135
[DOCUMENT_ROOT] => /home/*****.com/*****.com
[REQUEST_SCHEME] => http [CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => /home/*****.com/*****.com
[SERVER_ADMIN] => *********.com [SCRIPT_FILENAME] => /home/*****.com/*****.com/test_ip.php
[REMOTE_PORT] => 46879 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /test_ip.php [SCRIPT_NAME] => /test_ip.php [PHP_SELF] => /test_ip.php [REQUEST_TIME_FLOAT] => 1596949578.761 [REQUEST_TIME] => 1596949578 )

Offline

#9 2020-08-09 18:50:55

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: The IP address of the visitors is not displayed

Sorry, but I just can't reproduce. But what I see is incorrect values from your hosting...

[HTTP_X_FORWARDED_FOR] = Should be real IP now it's 127.0.0.1
[REMOTE_ADDR] = 109.80.146.135 Real IP

And as of HTTP_X_FORWARDED_FOR always has higher priority. Please FIX your server configuration or tell your hosting that real IP should be in HTTP_X_FORWARDED_FOR this field...

Offline

#10 2020-08-10 07:13:18

Jura
New member
Registered: 2020-08-07
Posts: 8

Re: The IP address of the visitors is not displayed

Thank you so much for help :-)
I will try to contact the web hosting provider.

Offline

#11 2020-08-11 16:22:12

Jura
New member
Registered: 2020-08-07
Posts: 8

Re: The IP address of the visitors is not displayed

Hi Remdex,
unfortunately, the situation cannot be solved.
Web hosting has a new security.
Is it possible to bypass this security in the next LiveHelperChat update?

I am sending you his statement.
Citation of technicial support:
************************************************************************
Good day,

this is due to the predominance of Nginx over Apache, this change occurred to maintain the stability of shared web hosts. Overriding x-forwarded-for with mod_remote_ip is automatically overridden to REMOTE_ADDR. This is a feature of shared hosting and I can't help you.

Thank you
Webmaster

Offline

#12 2020-08-11 16:34:08

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: The IP address of the visitors is not displayed

Hi,

That's incorrect workflow they are doing.

You can modify this function and just after "public static function getIP(){"

return $_SERVER["REMOTE_ADDR"];


https://github.com/LiveHelperChat/liveh … ect.php#L7

Offline

#13 2020-08-12 12:06:44

Jura
New member
Registered: 2020-08-07
Posts: 8

Re: The IP address of the visitors is not displayed

Hi Remdex,
thank you for support. I replaced the getIP function. I found this alternative  solution. It may be incorrect, but it works:

                      // Original to /*  */

    /* public static function getIP(){
        if (self::$couldflareRun == false){
            self::cloudflareInit();
            self::$couldflareRun = true;
        }
       if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '' ) {
            $_SERVER['REMOTE_ADDR'] = str_replace(' ', '', $_SERVER['HTTP_X_FORWARDED_FOR']);   
            $parts = explode(',', $_SERVER['REMOTE_ADDR']);
            $_SERVER['REMOTE_ADDR'] = $parts[0];
        }
        $_SERVER['REMOTE_ADDR'] = isset($_SERVER['REMOTE_ADDR']) ? strip_tags($_SERVER['REMOTE_ADDR']) : '127.0.0.1';
        return $_SERVER["REMOTE_ADDR"];
    } */


   

// Modification   - show real IP

    public static function getIp(): string
{
    $ip = null;
    if (isset($_SERVER['REMOTE_ADDR'])) {
        $ip = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
    }
    return is_string($ip) ? $ip : '127.0.0.1';
}

Offline

Board footer