Answer the question
In order to leave comments, you need to log in
How to deal with cookies using php?
Good afternoon.
I have a button on my site that causes the roulette wheel to appear. In the appearing block with a roulette there is an input type="submit" button, which sends data via ajax and is processed in the send.php file.
The problem is this: after clicking on this button, which spins the roulette wheel and sends data, the button that calls the roulette wheel for 30 days disappears. I decided to do this: in the send.php file, I create a cookie:
$cookie_date = date('d.m.Y');
setcookie("cookie_wheel", $cookie_date, time() + 9331200000);
<? if(!isset($_COOKIE['cookie_wheel'])){ ?>
<div style="height: 50px;" class="for_hidden"></div>
<div class="main for_hidden">
<div class="first">
<span>
<img src="..." width="30">
</span>
</div>
<div class="second">
<span><b>Испытай свою удачу - получи подарок</b></span>
</div>
<div class="third">
<span>
<svg>...</svg>
</span>
</div>
</div>
<? }
else { } ?>
Answer the question
In order to leave comments, you need to log in
Hello.
You seem to have an error in your code.
The function setcookie()
does not take a value
The second parameter y is the lifetime of the cookie - the function does notdate('d.m.Y')
setcookie()
time()
date()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question