ok. I see you examples, but please tell me something.
I have more cookies and the $ENV{'HTTP_COOKIE'} look something like this (ex: Steel%3A01%3A11=Noul%20Produs2%3A1%3A250%3A; Steel%3A01%3A10=Noul%20Produs%3A1%3A5000%3A)
, and i want to delete all my dates from $ENV{'HTTP_COOKIE'} with my script (please look my script), but this stupid script don't want , WHY?
I want the script to look on all my cookies and delete all (only cookies with $idProgram eq Steel and $nxRegCode eq 01), one by one.
Please help me man. Thank you.
#!perl -wT
use CGI::Carp('fatalsToBrowser');
use warnings;
use CGI qw(:standard);
use CGI::Cookie;
use CGI;
$query = CGI->new();
my %cookie = CGI::Cookie->fetch;
@decodareCookie = ('\%3A','\%20');
%decodareCookie = ('\%3A',':','\%20','##');
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
foreach $caracter (@decodareCookie) {
$cookie =~ s/$caracter/$decodareCookie{$caracter}/g;
$value =~ s/$caracter/$decodareCookie{$caracter}/g;
($idProgram, $nxRegCode, $nxIdProdus) = split (/:/, $cookie);
($nxDenumireP, $canditate) = split (/:/, $value);
}
if (($idProgram eq Steel) && ($nxRegCode eq 01)) {
my $cookieList = join(":",Steel,$nxRegCode,$nxIdProdus);
my $list = join(":",$nxDenumireP,$canditate);
my $cookie = CGI::Cookie->new(-name=>$cookieList,-value=>$list,-expire
+s=>'-1h');
print header(-cookie=>$cookie);
print "<center><h2>Produs adaugat pentru plata</h2></center><br>";
print "<br>$ENV{'HTTP_COOKIE'}";
}
}
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.