Cookies Enabled/Disabled

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Cookies Enabled/Disabled

Post by tecktalkcm0391 »

How can I make it so that if cookies are enabled it displays the HTML on the page, and if not it just displays a message like "Cookies must be enabled".

Code: Select all

<?php
//Cookie Check --- I could just help on that 
if (!$check_cookie){
?>
HTML FOR ERR MESSAGE

<?php 
} else {
 ?>

HTML FOR PAGE

<?php 
}
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Attempt to set a cookie on an intermediate page. Using a page level redirect to move forward, check that the cookie exists and is correct on the following page.
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

You can use javascript. After a quick google search I found this http://techpatterns.com/downloads/javas ... ookies.php hopefully it helps.
Post Reply