Make your own free website on Tripod.com

read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

$buffer =~ s/\+/ /g;

@array=split(/&/, $buffer);

foreach $array(@array)

{

($name,$value)=split (/=/, $array);

$FORM{$name}=$value;

}

$album=$FORM{D1};

$number=$FORM{T2};

$date=time;

$path="/";

$buffer = $ENV{'HTTP_COOKIE'};

print $buffer;

@array=split(/,/, $buffer);

foreach $array(@array)

{

($name,$value)=split (/=/, $array);

$FORM{$name}=$value;

}

$id=$FORM{id};

$name=$FORM{shopper};

if ($id eq ""){

&login;

}

&update_data($name,$album,$number);

print "Content-type: text/html\n\n";

print <<"EOM";

<html>

<head><title>Cookie test</title></head>

<body>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="continue.html">Continue Shopping</a></p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="scripts/show_cart.pl">Show my Cart</a></p>

</body>

</html>

EOM

sub update_data{

open (INPUT, ">>file.$name.$id");

my ($name,$album,$number);

$name = $_[0];

$album = $_[1];

$number = $_[2];

print INPUT<<"EOM";

$album $number

EOM

close (INPUT);

}

sub login{

print "Content-type: text/html\n\n";

print <<"EOM";

<html>

<head><title>Cookie test</title></head>

<body>

$buffer

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="shop.html">Please login</a> before shopping.</p>

</body>

</html>

EOM

exit;

}