1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html>\n<head>\n<title>decodage</title>\n</head>\n";
print "<body>\n";
read(STDIN, $donnees, $ENV{CONTENT_LENGTH});
@tab = split("&", $donnees);
%commande = ();
foreach $i (@tab){
($nom, $valeur) = split("=", $i);
$nom =~ s/%(..)/pack("c", hex($1))/ge;
$valeur =~ s/%(..)/pack("c", hex($1))/ge;
$valeur =~ s/\+/ /g;
$commande{"$nom"} = $valeur;
}
print "<H1>Votre commande</H1><HR>";
print "$commande{'nourriture'}<BR>";
print "pour $commande{'nombre_personnes'} personnes <BR>";
print "livré à $commande{'heure_livraison'} heures<BR>";
print "à l'adresse : <BR> $commande{'adresse'}<BR>";
print "</body></html>"; |
Partager