teorom Posté 13 Janvier 2008 Posté 13 Janvier 2008 bonjour, je recherche quelqu'un qui puisse m'aider à changer une variable dans le script suivant. ce script envoie à la validation d'un panier de commande, un appel vers un request.cgi dans le meme repertoire. le montant est généré automatiquement par ce script, il faut que la variable permette l'ouverture du request pour un paiement atos marcanet. ce script sendorder fait partie de web boutique 4. si quelqu'un pourrait m'aider, cela serait génial car je galére bien. fabien CODE #!/usr/bin/perl $mailprog = "/usr/lib/sendmail"; &ParseAndConvert; &SendOrderToShop; &SendOrderToClient; &CloseIt; exit(0); sub ParseAndConvert { if (@_) { local (*in) = _AT__; } local ($i, $loc, $key, $val); if ($ENV{'REQUEST_METHOD'} eq "GET" ) { $in = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST" ) { read(STDIN, $in, $ENV{'CONTENT_LENGTH'}); } $in_buffer = $in; _AT_in = split(/&/,$in); foreach $i (0 .. $#in) { $in[$i] =~ s/\+/ /g; $in[$i] =~ s/%(..)/pack("c",hex($1))/ge; $loc = index($in[$i],"=" ); $key = substr($in[$i],0,$loc); $val = substr($in[$i],$loc+1); $in{$key} .= '\0' if (defined($in{$key})); $in{$key} .= $val; } $Messagehtml = $in{'Messagehtml'}; $Search = q(<LV_061/> ); $Replace = q(=3D); $Messagehtml =~ s/$Search/$Replace/g; $Search = q(<LV_034/> ); $Replace = q(" ); $Messagehtml =~ s/$Search/$Replace/g; return 1; } sub SendOrderToShop { open(MAIL,"|$mailprog -t" ); print MAIL "To: $in{'To'}\n"; print MAIL "From: $in{'From'}\n"; print MAIL "Reply-To: $in{'From'}\n"; print MAIL "Subject: $in{'Subject'}\n"; print MAIL "MIME-Version: 1.0\n"; print MAIL "Content-Type: multipart/mixed; boundary=\"---- =_NextPart_$in{'OrderID'}\"\n\n"; print MAIL "This is a multi-part message in MIME format.\n\n"; print MAIL "------ =_NextPart_$in{'OrderID'}\n"; print MAIL "Content-Type: text/html; charset=ISO-8859-1\n"; print MAIL "Content-Transfer-Encoding: quoted-printable\n\n"; print MAIL "$Messagehtml\n\n"; print MAIL "------ =_NextPart_$in{'OrderID'}\n"; print MAIL "Content-Type: application/octet-stream;\n"; print MAIL " name=\"order-".$in{'OrderID'}.".lce\"\n"; print MAIL "Content-Transfer-Encoding: 8bit\n"; print MAIL "Content-Disposition: attachment;\n"; print MAIL " filename=\"order-".$in{'OrderID'}.".lce\"\n\n"; print MAIL "$in{'Attachment'}\n\n"; close(MAIL); } sub check_email { $email = $_[0]; if ($email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ || $email !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) { return 0; } else { return 1; } } sub SendOrderToClient { if (&check_email($in{'From'})) { open(MAIL,"|$mailprog -t" ); print MAIL "To: $in{'From'}\n"; print MAIL "From: $in{'To'}\n"; print MAIL "Reply-To: $in{'To'}\n"; print MAIL "Subject: $in{'SubjectMailClient'}\n"; print MAIL "MIME-Version: 1.0\n"; print MAIL "Content-Type: multipart/mixed; boundary=\"---- =_NextPart_$in{'OrderID'}\"\n\n"; print MAIL "This is a multi-part message in MIME format.\n\n"; print MAIL "------ =_NextPart_$in{'OrderID'}\n"; print MAIL "Content-Type: text/html; charset=ISO-8859-1\n"; print MAIL "Content-Transfer-Encoding: quoted-printable\n\n"; print MAIL "$Messagehtml\n\n"; print MAIL "------ =_NextPart_$in{'OrderID'}\n"; print MAIL "Content-Type: application/octet-stream;\n"; print MAIL " name=\"".$in{'SubjectMailClient'}.".txt\"\n"; print MAIL "Content-Transfer-Encoding: 8bit\n"; print MAIL "Content-Disposition: attachment;\n"; print MAIL " filename=\"".$in{'SubjectMailClient'}.".txt\"\n\n"; print MAIL "$in{'Message'}\n\n"; close(MAIL); } } sub CloseIt { # If redirect option is used, print the redirectional location header. # if ($in{'redirect'}) { print "Location: $in{'redirect'}\n\n"; } else { print "Content-type: text/html\n\n"; print qq| <html> <head> <title>$in{'Subject'}</title> </head> <BODY ONLOAD="setTimeout('window.close()',1)"> </body> </html> |; } }
Sujets conseillés
Veuillez vous connecter pour commenter
Vous pourrez laisser un commentaire après vous êtes connecté.
Connectez-vous maintenant