Question about cookies
| From: | Pieter Westland | Date: | Mon, 26 Jun 2000 13:15:29 +0000 |
| Subject: | Question about cookies | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3109@lists.php.net to get a copy of this message | ||
Hi php'ers,
Can someone tell me why the following does not work?
I want to create some scripting in which a user can access for 1 minute,
after the minute has expired he has to relogin. Things are configured
using a cookie.
Now the login-window pops up every time, it seems like a loop. You can
test what happens at http://da.csfr.org/new .
TIA!
Pieter
--
Hell, if you don't try to remake someone,
how are they supposed to know you care?
=================
<?php
if (!$testcookie) {
unset($PHP_AUTH_USER);
}
if (!$PHP_AUTH_USER) {
Header("WWW-authenticate: basic realm=\"Testsite\"");
Header("HTTP/1.0 401 Unauthorized");
echo "<body bgcolor=#ffffff>Cancel... (not logged in).\n"; exit;
}
setcookie ("testcookie", "foobar",time()+60); /* expire in 1 minute */
echo "logged in";
?>