0
I have an ad and I want to know if the person has already clicked on the ad in the last 2 days.
If it has already clicked, it does not appear but, if it has not clicked, it still appears.
Something like that:
<!DOCTYPE html>
<?php
setcookie("USER","sim", time() + 172800); // 86400 = 1 dia, 172800 = 2 dia
?>
<html>
<body>
<?php if (!isset($_COOKIE["USER"])): ?>
<div class="anuncio">
ANUNCIO PARA QUEM NÃO CLICOU AINDA!
</div>
<?php else: ?>
<div class="">
OPS, VC JA CLICOU NÃO APARECER ANUNCIO
</div>
<?php endif; ?>
</body>
</html>
But, how to know if he has already clicked into this <div>
, that is, if he has already clicked on the ad
You can use javascript to create a cookie, when it clicks on the ad, and then check if the cookie exists.
– Raizant
https://stackoverflow.com/questions/36493716/onclick-javascript-cookie
– Raizant
Help me ? No java script manjo.
– Matheus Vitor