PDA

View Full Version : Cookie Concerns


Pauly
November 4th, 2004, 17:06
This maybe easier than it seems to me, but I'll ask any way. Excuse me if I lose any one through explaining, it's quite complicated from my perspective.

A project I am working on requires cookies, fullstop. If they don't have them turned on, is it possible to detect this and tell them to turn them on to view the site correctly, but if they are on instead of this little warning message, they are given the cookie information.

I assume it could be done with IF and ELSE, in theory something like so;

IF cookies enabled
{display information like this
(
Cookie Name: $name
Location: $loc
Deleting this cookie will reset site settings & user information.
)
}
ELSE
{display this message
(
Cookies are not enabled. This may effect site viewing. For more information on enabling cookies click here.
)
}

Obviously that's nonsense and we all which it was that easy. But is that possible, to grab the name of the cookie and the location it was saved?

My concern;

I have actually asked 2 or 3 developers to help out with the project on the coding side. Paul 2 (the_pm) has done a very nifty script for me that requires cookies and uses JavaScript I believe to set them. But the problem occurs (I think) because the other developer doesn't know JavaScript and will be setting the cookies using PHP, is there anyway of integrating them effectively? I don't really want to create multiple cookies, but rather only one.

websterworld
November 4th, 2004, 17:08
There should be a way. But I for one am not psychic... :wink:

the_pm
November 4th, 2004, 17:46
Actually, the way I envisioned the JS would be used, everything would work just fine even with cookies and/or JS disabled! You place the elements you want to alter into their own CSS documents, but you echo the default documents in the master style sheet. This way, if someone doesn't have cookies/JS enabled, they simply see the default and they go about their lives - they won't even see the switcher. If they do have these enabled, they can make use of the style switching mechanism. So everything degrades perfectly.

But if you can replicate what I sent you in PHP, by all means do so. That would be much more reliable than JS! Unfortunately, I'll be no help at all there. I keep promising myself I'll learn PHP. Gotta get around to that one of these days...

;)

Pauly
November 4th, 2004, 17:54
Where did you send it? I must of missed it with all the vBulletin crap going on.

I don't think it will matter to much because a lot of users don't even bother about the cookies.

Are there any special tricks, hints or tips regarding cookies that I could make use of?

the_pm
November 4th, 2004, 18:01
I'm talking about the page I set up. Here's the link if others want to join in the frey: http://www.plhmedia.com/ex/OI/

It's extraordinarily buggy, so don't expect too much of it yet! The home page is still having trouble setting a default cookie. :(

I don't really have any tips for you. I pulled this code from a project I'm doing at work and modified it (heavily) to suit your needs. But I'm still looking in from the outside a bit when it comes to cookies.

Pauly
November 4th, 2004, 18:12
Ah yes, I remember that. It's almost how we originally intended though, doing a great job with that.

The cookie matter - I think I'll have to get more involved with these in the near future. Oi relies on them in the sense of a voting poll and the style changer.