I'm busy rewriting by F1 database and I want to use cookies to store
various user definable views, (basically so that when the visitor
returns to a specific page, that page will redisplay in the format that
visitor saved). Problem is, I don't know if the cookie was accepted or not.
setcook() returns TRUE if it worked but that doesn't indicate whether or
not it was accepted.
I tried the following:
/* $maskname = Name of the PHP 'cos there are different */
/* PHPs with different keep values */
/* $keepthis = A string indicating what fields to hide */
/* or display */
/* $keepdate = now() + 1 year so that it doesn't */
/* disappear when the visitor stops browsing */
setcookie($maskname, $keepthis, $keepdate);
$chckcook = $_COOKIE[$maskname];
if ($chckcook != $keepthis) {
$cookwork = false;
} else {
$cookwork = true;
} /* End of code portion */
But it always returns $cookwork = false. Where I'm going wrong?
The <html> tag is after the above bit of code although there are blank
lines, comments and other code between the <?php and this bit. I'm using
PHP Version 4.1.1 on a Win/2000 machine for development.
Basically, all I want to do is confirm that the cookie was written and
if not, then print up a message to tell the visitor that the cookie
wasn't stored so his carefully chosen format is going to disappear
unless he accepts the cookie.
MfG
Geoff.
--
Unofficial F1 Database: http://glibs.ssmmdd.co.uk/
Update: 11th July, 2004
USENET Email address is a spam trap, send Emails to address in the DB