Hi all

i am tracing ip addresses of all the site visitor using $_SERVER; and its working fine, But i want to exclude all ip starting from 172.122.*.* . i want to put "if" condition but don't know how to track these first two figure.
can anyone please tell me how can i exclude ip addresses starting from 172.122.?

Many Thanks in advance.

$ip = $_SERVER['remote_addr'];
$firstDigits = substr($ip, 0, 8);
if($firstDigits != '172.122.') {
//do whatever

Hope that helps :)

oh my god

you are just master of masters , i was unable to solve the problem since last 6 months.
Big thanks to you bro. it worked great and solved my problem.

aaaah how relaxing is it now.

Thanks again.


glad I could help! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.