I am currently working on a little website on which I have to make an account creation system. In order to know whether the user is already connected or not I would like use cookies cuz this was looking like the easiest way. However, after checking the official documentation on php.net, and some other forums, I'm still not able to create my cookie. Here is my code :
function connexionOK() {
$cookieName = "CookieCo";
$cookieValue = "true";
$isSent = setcookie($cookieName, $cookieValue, time() + 3600, "/");
if($isSent) {
echo '<script type="text/javascript">';
echo "alert('Cookie envoyé');";
echo "</script>";
}
else {
echo '<script type="text/javascript">';
echo "alert('Cookie failed');";
echo "</script>";
}}
So the page is indeed alerting me 'Cookie failed'.
Thanks for everyone who've been trying to help me ! :)