mardi 31 mars 2015

Open ad clicking anywhere in wordpress

I have wordpress site and I'm using this script



onclick="<?php if(!isset($_COOKIE['visited'])){echo"window.open('http://link', '_blank')"; setcookie("visited", "1", time()+3600*24); header("Refresh:0");} ?>"


in body line. So it means I'm using



<body <?php body_class(); ?> onclick="<?php if(!isset($_COOKIE['visited'])){echo"window.open('http://link', '_blank')"; setcookie("visited", "1", time()+3600*24); header("Refresh:0");} ?>">


on header.php file of the theme.


But it opens the link in every click. I want to open it only one time until I refresh the page or open new page. How can I do it. Please help. Thanks in advance.


Greetings.


Aucun commentaire:

Enregistrer un commentaire