Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Cookies

Status
Not open for further replies.

theguru97321

IS-IT--Management
Feb 3, 2003
216
US
I have a site that is 'secure' it uses a cookie called ACCESS this data is stored in a database until the user closes the window, or logs out(gets deleted from database).

I would like to add a 'Remember Me' feature to the site, with out destroying the existing security. I use DBI and CGI calls, it seems that I can't use query->cookie after DBI is called, so this stops the ability to 'remember' what user was logged in based on his user_id.

How else can I go about this?

I have some knowledge of all this, but not enough to come up with the right answer, and maybe not even the right questions. I've search this and other sites for something to work with, and have come up blank. My head hurts.
 
get a good night's sleep, not just his, also her user id, may be important


Nancy Griffith - songstress extraordinaire,
and composer of the snipers anthem "From a distance ...
 
Try sending a second cookie to the user if they choose the 'Remember Me' option that doesn't expire and is never deleted from the database. This way, the remember me information can be kept separate from your actual session data.

Code:
print header(-cookie => [$cookie1, $cookie2]);

- Rieekan
 
I get the following error when I try to run the 'header' command.

Undefined subroutine &main::header called at [PATH and FILE] line 71.
[Wed Nov 24 09:02:56 2004] [error] [client MY.IP.ADDRESS] Premature end of script headers: [PATH and FILE]
 
Fixed it for the time being with 'print CGI::header' instead of just 'print header'.
 
Ok, I got it creating a cookie, I've verified that it actually creates on in the Temp Internet Files.

Now...How do I
1) check for it's existance?
2) pull data from that cookie?
 
I have it reading the cookie, but i'm still having an issue with my previous security. I'm testing for the existance of the 'access' cookie, that is removed from the database upon logout..but it's not being removed from the browser.. how do I delete a cookie from the broswer, with my cgi code?
 
For some reason my CookieName is /cgi-bin .. how do i get it to be the name of my site, like the cookie is on this site?
 
For both of your responses, I think it would be a good idea to go over the CGI::Cookie module documentation. The answers to both of your questions are very clearly documented in this module.

- Rieekan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top