select * from popups where idSpace=2 and (active=1 or authorized_ips like '%216.73.216.27%') and (id in (select idPopup from popups_pages where url like '/index.php' and active=1) or id not in (select idPopup from popups_pages where active=1))
216.73.216.27