I'm having the same header problem as the mark.
I removed all the headers and the script still functions, but it doesn't
print the cookie header. There is a module for deleting previous headers but I
can't remember what it's called.
#!C:/Perl/bin/perl.exe
BEGIN{open(STDERR, ">./errors/order.txt")}
use strict;
use CGI;
my$q = CGI::new();
my%item;
if($q->param("Cemail")){&writeorder;}
else{&writecookie;}
sub writeorder{
}
sub writecookie{
if($q->param("item")){
my$cookname = "cart";
my$name = $q->param("item");
$name =~ s/[^\w]//g;
my$price = $q->param("price");
$price =~ s/[^\d\.]//g;
my$qty = $q->param("qty");
$qty =~ s/[^\d]//g;
[EMAIL PROTECTED] = $q->param();
foreach(@keys){$item{$_} = $q->param($_);}
my$opts = "";
foreach(keys %item){unless(/price|item|qty|x|y/){$opts .= "$_:
$item{$_}*"}}
my$item = "name=$name|price=$price|qty=$qty|allopts=$opts--";
my$bc = $q->cookie($cookname);
[EMAIL PROTECTED] = split(/\n/, $bc);
my$fl = 0;
foreach(@allitems){
if($fl){$_ = ""}
if(/$name/){
$fl = 1;
s/qty=.*?\|?/qty=$qty/;
s/price=.*?\|/price=$price/;
}
}
unless($fl){push(@allitems, $item);}
my$ck;
foreach(@allitems){$ck .= "$_\n";}
my $cookie = $q->cookie(
-NAME => $cookname,
-VALUE => $ck,
-EXPIRES => "1d"
);
[EMAIL PROTECTED] = split(/\~/, $opts);
$opts[0] = "($opts[0]";
for(my$i=0;$i<@opts;$i++){if($i < @opts-1){$opts[$i] .= ", "}}
my$no = @opts -1;
$opts[$no] = "$opts[$no])";
print $q->header(-COOKIE => $cookie),
print qq{
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>ConquistaDoors.com</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Content-Language" CONTENT="EN-GB">
</SCRIPT>
</HEAD><BODY class="main">
<SCRIPT type='text/javascript'>
alert('The item \\n $name @opts\\n was added to your cart. The option to
remove items is given on the checkout page.');
document.location.href='$ENV{'HTTP_REFERER'}';
</SCRIPT>
</BODY></HTML>
};
}
}