S
S
solalex2015-10-07 20:44:43
1C-Bitrix
solalex, 2015-10-07 20:44:43

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

2 answer(s)
K
KronosHD, 2015-10-07
@KronosHD

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
";
}

S
Sergey, 2015-10-07
@Logic87

You can try this solution https://marketplace.1c-bitrix.ru/solutions/altasib...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question