Unfortunately it is all too possible to have 2 cookies with an identical name. I'm not the only one that I've heard of with this problem. I do believe the problem is related to how the browser handles the path, but when you read a cookie, you have no control over that (unless you can correct me on this).
I already posted the code I use to reed the cookie. I simply use $ENV{'HTTP_COOKIE'}. That returns a string containing all the cookies for that site on the user's browser. Also, there is no case problem or errant character with the name. I wish it were that somple.
I am aware that a user can log in from more than one PC, but my site only keeps the most recent cookie image from that user as a snap shot, so I don't store a cookie from each PC. Also note that for the cookie I use, I set the expiration to 1 year, so the cookie hangs around for a lot longer than many cookies do. If you use cookies, you may be having this problem, but aren't aware of it either because your expiration is so short, or an old duplicate cookie won't cause problems in your code.
The code to write the cookie is...
.
.
$co = new CGI;
.
.
.
$newunp = join('|',@batch);
$ck_unp = $co->cookie(
-name=>'unp',
-value=>$newunp,
-expires=>'+365d'
);
print $co->header(-cookie=>$ck_unp);
.
.
Again, thanks for any help.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.