Answered step by step
Verified Expert Solution
Question
1 Approved Answer
if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } $IPv4= explode(.,$ip); echo Your IP:
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{ $ip = $_SERVER['HTTP_CLIENT_IP']; }
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{ $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; }
else { $ip = $_SERVER['REMOTE_ADDR']; }
$IPv4= explode(".",$ip);
echo "Your IP: $ip ";
for the last part, If state ment should be if the IP include 100 or 101, it connected from school else it is NOT connected from school .
I tried preg_match() but it doesn't work. what should I use for this if statement?
?php if (lempty(S_SERVER['HTTP CLIENTIP])) { $ip= $_SERVER('HTTP-CLIENT-IP']; } elseif (lempty($_SERVER('HTTP-X-FORWARDED-FOR'])) { $ip=$_SERVER('HTTP-X-FORWARDED-FOR']; } else { $ip = $_SERVER('REMOTE_ADDR']; } $IPv4= explode(".",$ip); echo " Your IP: iplnStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started