I really don't know what the problem is.
I have a script called "login.php" that works fine. It is called with AJAX, and if it returns successfully, the page is updated and the user is logged in. A cookie is set on this page using
setcookie("main", $row[0], time() + 3600, "/")
Then I have a script called "logout.php". It is called the same way (AJAX and then page refresh). It has only two lines:
<?php
setcookie("main", "", time() - 3600, "/");
echo "Done";
?>
Calling it from the page did not work, so I just downloaded logout.php in the browser. The result was "completed", but checking my cookies in Chrome showed me that the cookie is still set to "1" (which was $ row [0]) and expires at the moment set in login.php.
login.php and logout.php are in the same folder, the root directory, which is the same folder as everything else.
This used to work, but the only changes I made was to make the header on the website my own file (still in the root directory) and use the JavaScript functions for the "Exit" button, which is just an AJAX call and some jQuery freezing effects and make it own script file, which is located in the _js folder. But I didn't change logout.php at all, so it should work when I go directly to it, right? Is there something wrong with my setcookie command, or what other problem might cause it?
EDIT: 100 -3600, , cookie. . cookie .
EDIT 2: , . , (logout.php ) script .