RE: [PHP] Must Have Cookies. PHP/JavaScript
| From: | Johnson, Kirk | Date: | Thu, 05 Jul 2001 21:52:38 +0000 |
| Subject: | RE: [PHP] Must Have Cookies. PHP/JavaScript | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-56392@lists.php.net to get a copy of this message | ||
On the *2nd* page request you can check for your cookie in
$HTTP_COOKIE_VARS. If it is not there, cookies are disabled in the browser.
Here's a kludge to make your "first" page the 2nd page request: just start
your session on index, then META redirect to the next page; this 2nd page is
where you actually output HTML to the browser, and also check for the
cookie.
function check_cookies() {
global $HTTP_COOKIE_VARS;
if(!$HTTP_COOKIE_VARS["PHPSESSID"]) {
// redirect to the cookie error page;
exit();
}
Kirk
> -----Original Message-----
> From: Jeff Gannaway [mailto:webmaster@cactusgraphics.com]
> Subject: [PHP] Must Have Cookies. PHP/JavaScript
> The same page MUST identifier whether the cookie was accepted
> or not. I've
> seen sites like NetFlix.com that will test to see if their cookie was
> accepted, and if not, print up a page that says "Sorry,
> you've got have
> your Cookies on or go somewhere else."
>
> Does anyone know how to do this with PHP, Java, or JavaScript?