ip problem

Started on the old forum in March 2017 · view the original in the archive · old links redirect here

4 replies · 120 views · started 9 years ago · 1 min read

4 participants
thunderwap Developer · 169 posts #1

hello

why google and my site shows weird ip address of me. i checked few other ip check sites and they showed well in i.e ip2location.com

please see screenshot of google showing my ip

my site also showing same ip as google showing. but in other few sites it shows my real ip address.

what is the wrong with my code in php?

i am using

 $myip = $_SERVER["REMOTE_ADDR"];  

echo "$myip"; 
  

i also tried explode method with it but though it shows same error

please see screenshot.

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

Attachments: ip_pro.jpg fg.jpg
tupac Developer · 95 posts #2

I think this is the new version of ip addresses bro nothing to worry about....and to my knowledge the code looks perfectly fine

thunderwap Developer · 169 posts #4

what do i do to show ip adddress even if my isp uses IPv6?

i want to show both IPv4 and IPv6

will this work if i use

function get_client_ip() {
$ipaddress = '';
if (isset($_SERVER['HTTP_CLIENT_IP']))
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_X_FORWARDED']))
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_FORWARDED']))
$ipaddress = $_SERVER['HTTP_FORWARDED'];
else if(isset($_SERVER['REMOTE_ADDR']))
$ipaddress = $_SERVER['REMOTE_ADDR'];
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
}

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

something else Fellow · 2,296 posts #5
function getIp()
{
    $ip = $_SERVER['REMOTE_ADDR'];
    if(substr_count($ip,':')>2)
    {
        $ip = hexdec(substr($ip, 0, 2)). "." . hexdec(substr($ip, 2, 2)). "." . hexdec(substr($ip, 5, 2)). "." . hexdec(substr($ip, 7, 2));
    }
    return $ip;
}

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close