Question

I have used this code

$ip =  change_ipv4_ipv6($_SERVER['REMOTE_ADDR']);
$giasn = geoip_open("GeoIPASNumv6.dat", GEOIP_STANDARD);
$asn = geoip_name_by_addr_v6($giasn, $ip);
geoip_close($giasn);

after this code i echo record like this

echo 'Shell';

It gives result like this

1111111111111111111Shell

When i remove geopip code then it shows result like below

Shell

I want to get ride of these Ones. Any advice

thanks

Was it helpful?

Solution

It's likely that somewhere in one of those functions a 1 is being printed.

Search for print/echo in the geoip functions, it's a stab in the dark, but I'd like to guess that it is echoing a boolean.

When you said "When i remove geopip code then it shows result like belo"w

This should give you a clue that the echo is coming from the geoip code, try commenting out the functions one by one to figure out which function is causing it.

OTHER TIPS

I tested this with the latest version of the GeoIP from GitHub and I could not reproduce it. I would recommend upgrading your version of the library.

These ones certainly get echoed somewhere else in the code. Try to include an unmodified copy of the geoip library, or try to find the exact place in your code where they get echoed.

You can suppress output from geoip function by using ob_start() and ob_end_clean():

ob_start();
$ip =  change_ipv4_ipv6($_SERVER['REMOTE_ADDR']);
$giasn = geoip_open("GeoIPASNumv6.dat", GEOIP_STANDARD);
$asn = geoip_name_by_addr_v6($giasn, $ip);
geoip_close($giasn);
ob_end_clean();

echo 'Shell';

I got issue. Putting here might help some one else come on this post

I have a function called in my code to convert ip class. here that was

change_ipv4_ipv6($_SERVER['REMOTE_ADDR']);

in this function i was echoing answer. I replace all echo with return. now 1111111 disappear. thanks for your useful answers

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top