Código PHP:
<!-- SCRIPT control Popup -->
<script>
function getCookie(c_name){
var c_value = document.cookie;
var c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1){
c_start = c_value.indexOf(c_name + "=");
}
if (c_start == -1){
c_value = null;
}else{
c_start = c_value.indexOf("=", c_start) + 1;
var c_end = c_value.indexOf(";", c_start);
if (c_end == -1){
c_end = c_value.length;
}
c_value = unescape(c_value.substring(c_start,c_end));
}
return c_value;
}
function setCookie(c_name,value,exdays){
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
if(geoip_country_code()=="ES" && getCookie('aviso')!="1"){
document.getElementById("popup").style.display="block";
}
function PonerCookie(){
setCookie('aviso','1',365);
document.getElementById("popup").style.display="none";
}
</script>
Código PHP:
<div id="popup" style="display: block;">
<div class="cuerpo">
<p><a href="javascript:void(0);" class="ok" onclick="PonerCookie();"><img src="images/close.png" width="25" height="25"></a></p>
<p><b>¡No te pierdas ninguna oferta!</b></p>
<p><b>Síguenos en las RRSS</b></p>
<p><b>Descárgate nuestra App</b></p>
</div>
</div>