tags:

views:

237

answers:

1

I know this is usually done with cookies, but I am getting unpredictable results on different browsers and decided to look for a pear package that focuses on this. Just wondering if there's a package (HTTP_Client for example?) that anyone has had success using for this particular situation. Or actually, do people never or rarely have problems with the routine of setting a cookie manually and checking for them? Is it common to use a package for dealing with cookies?

+1  A: 

There is such functionality in PEAR::LiveUser, though I strongly believe it will be overkill. Here's a description of the functionality you are requesting taken from the end user docs:

setRememberCookie [line 1326] bool setRememberCookie( string $handle, string $passwd)

If cookies are allowed, this method checks if the user wanted a cookie to be set so he doesn't have to enter handle and password for his next login. If true, it will set the cookie.

* Return: true if the cookie can be set, false otherwise
* Access: public

Parameters: string $handle — handle of the user trying to authenticate string $passwd — password of the user trying to authenticate

What about the cookie checking is giving you trouble? You could have the www vs. non-www, subdomain vs. domain, or any number of logic issues. I remember working on a PHP authentication system that did just what you are doing, but I also remember it being a bear to work on. Of course your mileage may vary. :)

Abyss Knight