Answer the question
In order to leave comments, you need to log in
How to display a banner depending on the IP?
Tell. you need to show an advertising banner when entering a specific page of the site, but not immediately, but after a minute of being on the page. And for certain IP this banner should not be shown.
Answer the question
In order to leave comments, you need to log in
function getIP() {
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
return $_SERVER['REMOTE_ADDR'];
}
if (in_array(getIP(), array('5.9.72.245', '5.9.72.243', '5.9.29.230'))) {
echo
"
No banner should be displayed for these IPs
";
}
elseif(in_array(getIP(), array('5.9.72.242', '5.9.29.231'))){
echo
"
And for these it displays a banner
";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question