- This topic is empty.
-
AuthorPosts
-
October 11, 2009 at 10:31 am #26411limonkhanMember
Why aren’t my cookies working?
PHP cookies are a relatively simple way of tracking users by storing information in their browser. Here are the most common reasons a cookie isn’t working.
Answer: If your cookies aren’t being set, one very common problem is that something is being sent to the browser before the cookie. The cookies need to be in the header and come before any HTML. For example:
*insert stupid spam footer link*
October 11, 2009 at 6:42 pm #65273Rob MacKayParticipantWell you have to remember that they don’t harden in the oven, you have to take them out and they harden when they cool down.
Nom nom nom!
All hail clever-ish spam
October 14, 2009 at 1:37 pm #65479davesgonebananasMemberCAN I HAZ COOKIE TOO?
But they shouldn’t harden Rob – they should remain all gooey and yummy inside :)
October 14, 2009 at 4:53 pm #65484Rob MacKayParticipant"davesgonebananas" wrote:CAN I HAZ COOKIE TOO?But they shouldn’t harden Rob – they should remain all gooey and yummy inside :)
very true – soft enough to melt in the mouth, hard enough to hold… maybe the word should be "set" instead of harden…
October 14, 2009 at 5:07 pm #65493davesgonebananasMemberWe should maybe start our own forums on how to get the ‘perfect’ cookie?
Hehe
October 15, 2009 at 5:16 am #65516Rob MacKayParticipantBananacookies.com lol
October 15, 2009 at 10:02 am #65523davesgonebananasMemberThe Cheeky Monkeys want $1200 for that domain! PFfft!
October 16, 2009 at 12:03 pm #65564Rob MacKayParticipantdamn them!!!
November 8, 2009 at 1:18 am #66345alex001ParticipantIf your cookies aren’t being set, one very common problem is that something is being sent to the browser before the cookie. The cookies need to be in the header and come before any HTML. For example:
<html>
<head>
<title>My Page</title>
<?php
$Month = 2592000 + time();
setcookie(AboutVisit, date("F jS – g:i a"), $Month);
?>This code won’t work, because you are sending the data (the <html> and other tags) to the browser before the cookie. Instead you should use something like this:
<?php
$Month = 2592000 + time();
setcookie(AboutVisit, date("F jS – g:i a"), $Month);
?>
<html>
<head>
<title>My Page</title>If the problem is that the cookies work for most users but some users are having problems with them, it may be that those particular users have cookies disabled in their browsers. This is not a problem with your code at all, just a user’s personal preference
November 8, 2009 at 7:36 pm #66381Rob MacKayParticipantBest spam post yet! Almost on topic to the spam post that started the thread! awesome. Footer link removed.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.