Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Common.php Error Rate Topic   - - - - -

 
  • becomarius
  • Senior Member
  • Members
  • Join Date: 09-Feb 12
  • 193 posts

Posted 18 February 2018 - 08:10 PM #1

Hi all again

 

I just make masiv changes with csv file for all product title H1

And change all seo-names

 

and i have this...now

[18-Feb-2018 22:00:02 Europe/Bucharest] PHP Notice:  Undefined index: REMOTE_ADDR in /home/xxxxxx/public_html/app/functions/fn.common.php on line 1927

and the place

/ The function returns Host IP and Proxy IP.
//
function fn_get_ip($return_int = false)
{
    $forwarded_ip = '';
    $fields = array(
        'HTTP_X_FORWARDED_FOR',
        'HTTP_X_FORWARDED',
        'HTTP_FORWARDED_FOR',
        'HTTP_FORWARDED',
        'HTTP_forwarded_ip',
        'HTTP_X_COMING_FROM',
        'HTTP_COMING_FROM',
        'HTTP_CLIENT_IP',
        'HTTP_VIA',
        'HTTP_XROXY_CONNECTION',
        'HTTP_PROXY_CONNECTION');

    $matches = array();
    foreach ($fields as $f) {
        if (!empty($_SERVER[$f])) {
            preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $_SERVER[$f], $matches);
            if (!empty($matches) && !empty($matches[0]) && $matches[0] != $_SERVER['REMOTE_ADDR']) {
                $forwarded_ip = $matches[0];
                break;
            }
        }
    }

    $ip = array('host' => $forwarded_ip, 'proxy' => $_SERVER['REMOTE_ADDR']);

    if ($return_int) {
        foreach ($ip as $k => $_ip) {
            $ip[$k] = empty($_ip) ? 0 : sprintf("%u", ip2long($_ip));
        }
    }

    if (empty($ip['host']) || !fn_is_inet_ip($ip['host'], $return_int)) {
        $ip['host'] = $ip['proxy'];
        $ip['proxy'] = $return_int ? 0 : '';
    }

    return $ip;
}

//
// If there is IP address in address scope global then return true.
//
function fn_is_inet_ip($ip, $is_int = false)
{
    if ($is_int) {
        $ip = long2ip($ip);
    }
    $_ip = explode('.', $ip);

    return
        ($_ip[0] == 10 ||
        ($_ip[0] == 172 && $_ip[1] >= 16 && $_ip[1] <= 31) ||
        ($_ip[0] == 192 && $_ip[1] == 168) ||
        ($_ip[0] == 127 && $_ip[1] == 0 && $_ip[2] == 0 && $_ip[3] == 1) ||
        ($_ip[0] == 255 && $_ip[1] == 255 && $_ip[2] == 255 && $_ip[3] == 255))
        ? false : true;
}

// Workaround for PHP < 5.4

I have no idee :(


CS Cart lovers


 
  • poppedweb
  • Authorized Reseller
  • Members
  • Join Date: 02-Aug 16
  • 547 posts

Posted 18 February 2018 - 10:15 PM #2

Hi all again

 

I just make masiv changes with csv file for all product title H1

And change all seo-names

 

and i have this...now

[18-Feb-2018 22:00:02 Europe/Bucharest] PHP Notice:  Undefined index: REMOTE_ADDR in /home/xxxxxx/public_html/app/functions/fn.common.php on line 1927

and the place

/ The function returns Host IP and Proxy IP.
//
function fn_get_ip($return_int = false)
{
    $forwarded_ip = '';
    $fields = array(
        'HTTP_X_FORWARDED_FOR',
        'HTTP_X_FORWARDED',
        'HTTP_FORWARDED_FOR',
        'HTTP_FORWARDED',
        'HTTP_forwarded_ip',
        'HTTP_X_COMING_FROM',
        'HTTP_COMING_FROM',
        'HTTP_CLIENT_IP',
        'HTTP_VIA',
        'HTTP_XROXY_CONNECTION',
        'HTTP_PROXY_CONNECTION');

    $matches = array();
    foreach ($fields as $f) {
        if (!empty($_SERVER[$f])) {
            preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $_SERVER[$f], $matches);
            if (!empty($matches) && !empty($matches[0]) && $matches[0] != $_SERVER['REMOTE_ADDR']) {
                $forwarded_ip = $matches[0];
                break;
            }
        }
    }

    $ip = array('host' => $forwarded_ip, 'proxy' => $_SERVER['REMOTE_ADDR']);

    if ($return_int) {
        foreach ($ip as $k => $_ip) {
            $ip[$k] = empty($_ip) ? 0 : sprintf("%u", ip2long($_ip));
        }
    }

    if (empty($ip['host']) || !fn_is_inet_ip($ip['host'], $return_int)) {
        $ip['host'] = $ip['proxy'];
        $ip['proxy'] = $return_int ? 0 : '';
    }

    return $ip;
}

//
// If there is IP address in address scope global then return true.
//
function fn_is_inet_ip($ip, $is_int = false)
{
    if ($is_int) {
        $ip = long2ip($ip);
    }
    $_ip = explode('.', $ip);

    return
        ($_ip[0] == 10 ||
        ($_ip[0] == 172 && $_ip[1] >= 16 && $_ip[1] <= 31) ||
        ($_ip[0] == 192 && $_ip[1] == 168) ||
        ($_ip[0] == 127 && $_ip[1] == 0 && $_ip[2] == 0 && $_ip[3] == 1) ||
        ($_ip[0] == 255 && $_ip[1] == 255 && $_ip[2] == 255 && $_ip[3] == 255))
        ? false : true;
}

// Workaround for PHP < 5.4

I have no idee :(

 

You do not have an IP adress because you are doing it locally I assume. Just change linee 1927 as follows (!not tested):

$ip = array(
    'host' => $forwarded_ip, 
    'proxy' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'
);


PoppedWeb | sales@poppedweb.com | https://poppedweb.com
TurnKey Website Design | Add-Ons | Performance Audits | Dedicated Server Management
24/7 Support | Response within an hour (during working hours).

 
  • becomarius
  • Senior Member
  • Members
  • Join Date: 09-Feb 12
  • 193 posts

Posted 19 February 2018 - 07:31 AM #3

No way

I am online

 

...and looks Google alanalytics is crash... ZERO ... but the code it is ok

 

an i have another row everytime when someone visit website

soo.. that 1927 and:

 

[19-Feb-2018 09:02:02 Europe/Bucharest] PHP Notice:  Undefined index: REQUEST_METHOD in /home/xxxxx/public_html/app/Tygh/Registry.php on line 510

 

and place:


            if ($id == 'time') {
                $key = 'time';
            } elseif ($id == 'static') {
                $key = 'cache_' . ACCOUNT_TYPE;
            } elseif ($id == 'day') {
                $key = date('z', TIME);
            } elseif ($id == 'locale') {
                $key = (defined('CART_LOCALIZATION') ? (CART_LOCALIZATION . '_') : '')
                    . CART_LANGUAGE . '_' . CART_SECONDARY_CURRENCY;
            } elseif ($id == 'dispatch') {
                $key = AREA . '_' . $_SERVER['REQUEST_METHOD'] . '_' . str_replace('.', '_', $_REQUEST['dispatch'])
                    . '_' . (defined('CART_LOCALIZATION') ? (CART_LOCALIZATION . '_') : '')
                    . CART_LANGUAGE . '_' . CART_SECONDARY_CURRENCY;
            } elseif ($id == 'user') {
                $key = AREA . '_' . $_SERVER['REQUEST_METHOD'] . '_' . str_replace('.', '_', $_REQUEST['dispatch'])
                    . '.' . $usergroups_condition
                    . '.' . (defined('CART_LOCALIZATION') ? (CART_LOCALIZATION . '_') : '')
                    . CART_LANGUAGE . '.' . CART_SECONDARY_CURRENCY;
            } elseif ($id == 'locale_auth') {
                $key = AREA . '_' . $_SERVER['REQUEST_METHOD'] . '_' . (!empty(\Tygh::$app['session']['auth']['user_id']) ? 1 : 0)
                    . '.' . $usergroups_condition
                    . (defined('CART_LOCALIZATION') ? (CART_LOCALIZATION . '_') : '')
                    . CART_LANGUAGE . '.' . CART_SECONDARY_CURRENCY;
            } elseif ($id == 'html_blocks') {
                $promotion_condition = '';
                if (!empty(\Tygh::$app['session']['auth']['user_id'])) {
                    $active_promotions = db_get_fields(

CS Cart lovers


 
  • poppedweb
  • Authorized Reseller
  • Members
  • Join Date: 02-Aug 16
  • 547 posts

Posted 19 February 2018 - 07:50 AM #4

 

No way

I am online

 

...and looks Google alanalytics is crash... ZERO ... but the code it is ok

 

an i have another row everytime when someone visit website

soo.. that 1927 and:

 

[19-Feb-2018 09:02:02 Europe/Bucharest] PHP Notice:  Undefined index: REQUEST_METHOD in /home/xxxxx/public_html/app/Tygh/Registry.php on line 510

 

and place:


            if ($id == 'time') {
                $key = 'time';
            } elseif ($id == 'static') {
                $key = 'cache_' . ACCOUNT_TYPE;
            } elseif ($id == 'day') {
                $key = date('z', TIME);
            } elseif ($id == 'locale') {
                $key = (defined('CART_LOCALIZATION') ? (CART_LOCALIZATION . '_') : '')
                    . CART_LANGUAGE . '_' . CART_SECONDARY_CURRENCY;
            } elseif ($id == 'dispatch') {
                $key = AREA . '_' . $_SERVER['REQUEST_METHOD'] . '_' . str_replace('.', '_', $_REQUEST['dispatch'])
                    . '_' . (defined('CART_LOCALIZATION') ? (CART_LOCALIZATION . '_') : '')
                    . CART_LANGUAGE . '_' . CART_SECONDARY_CURRENCY;
            } elseif ($id == 'user') {
                $key = AREA . '_' . $_SERVER['REQUEST_METHOD'] . '_' . str_replace('.', '_', $_REQUEST['dispatch'])
                    . '.' . $usergroups_condition
                    . '.' . (defined('CART_LOCALIZATION') ? (CART_LOCALIZATION . '_') : '')
                    . CART_LANGUAGE . '.' . CART_SECONDARY_CURRENCY;
            } elseif ($id == 'locale_auth') {
                $key = AREA . '_' . $_SERVER['REQUEST_METHOD'] . '_' . (!empty(\Tygh::$app['session']['auth']['user_id']) ? 1 : 0)
                    . '.' . $usergroups_condition
                    . (defined('CART_LOCALIZATION') ? (CART_LOCALIZATION . '_') : '')
                    . CART_LANGUAGE . '.' . CART_SECONDARY_CURRENCY;
            } elseif ($id == 'html_blocks') {
                $promotion_condition = '';
                if (!empty(\Tygh::$app['session']['auth']['user_id'])) {
                    $active_promotions = db_get_fields(

 

Well this just points the finger right at server configuration. If your server predefined variables haven't been set accordingly I would have no clue how to help you. I suggest you contact your host to determine the root cause of this problem.


PoppedWeb | sales@poppedweb.com | https://poppedweb.com
TurnKey Website Design | Add-Ons | Performance Audits | Dedicated Server Management
24/7 Support | Response within an hour (during working hours).