Hi sorry the script is as below
#!/usr/bin/perl
# ----------------------------------------------------
# -----
# ----- Forms To Go v2.5.9 by Bebosoft, Inc.
# -----
# -----
# -----
# ----------------------------------------------------
#----------
# Validate: String
sub check_string
{
local($value, $low, $high, $mode, $optional) = @_;
if ( (length($value) == 0) && ($optional == 1) ) {
return 1;
}
elsif ((length($value) >= $low) && ($mode == 1)) {
return 1;
}
elsif ((length($value) <= $high) && ($mode == 2)) {
return 1;
}
elsif ((length($value) >= $low) && (length($value) <= $high) && ($mode == 3)) {
return 1;
}
else {
return 0;
}
}
#----------
# Validate: Email
sub check_email
{
local($email, $optional) = @_;
if ( (length($email) == 0) && ($optional == 1) ) {
return 1;
}
elsif ( $email !~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ && $email =~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z0-9]+)(\]?)$/ ) {
return 1;
}
else {
return 0;
}
}
$mailProg = '/usr/sbin/sendmail ';
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs){
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
$name = $FORM{'name'};
$email = $FORM{'email'};
$Submit = $FORM{'Submit'};
# Field Validations
$validationFailed = 0;
if ( (! check_string($name, 1, 0, 1, 0))) {
$validationFailed = 1;
}
if ( (! check_email($email, 0))) {
$validationFailed = 1;
}
# Embed error page and dump it to the browser
if ($validationFailed == 1) {
$fileErrorPage = 'error.html';
if (!(-e $fileErrorPage)) {
print "Content-type: text/html\n\n";
print 'The error page: <b>error.html</b> cannot be found on the server.';
exit;
}
open(HANDLE, $fileErrorPage);
@errorPage = <HANDLE>;
close(HANDLE);
foreach $pageLine (@errorPage) {
$errorPage .= $pageLine;
}
$errorPage =~ s/<!--VALIDATIONERROR-->/$errorList/;
$errorPage =~ s/<!--FIELDVALUE:name-->/$name/;
$errorPage =~ s/<!--FIELDVALUE:email-->/$email/;
$errorPage =~ s/<!--FIELDVALUE:Submit-->/$Submit/;
print "Content-type: text/html\n\n";
print $errorPage;
exit;
}
# Email to Form Owner
$emailTo = '"ian" <ian@thestoragecompany.co.uk>';
$emailFrom = $email;
$emailSubject = "trial";
open(MAIL,"|$mailProg");
print MAIL "To: $emailTo\n";
print MAIL "From: $emailFrom\n";
print MAIL "Subject: $emailSubject\n";
print MAIL "Reply-To: $emailFrom\n";
print MAIL "Return-Path: $emailFrom\n";
print MAIL "X-Sender: $emailFrom\n";
print MAIL "Content-Type: text/plain; charset:\"ISO-8859-1\"\n";
print MAIL "Content-Transfer-Encoding: quoted-printable\n";
print MAIL "\n";
print MAIL "name: $name\n"
. "email: $email\n"
. "Submit: $Submit\n"
. "\n"
. "this is an email from a client to the company it is the tenth trial using php\n"
. "\n"
. "";
print MAIL "\n";
close(MAIL);
# Confirmation Email to User
$confEmailTo = $email;
$confEmailFrom = 'ian@thestoragecompany.co.uk';
$confEmailSubject = "test";
open(MAIL,"|$mailProg");
print MAIL "To: $confEmailTo\n";
print MAIL "From: $confEmailFrom\n";
print MAIL "Subject: $confEmailSubject\n";
print MAIL "Content-Type: text/plain; charset:\"ISO-8859-1\"\n";
print MAIL "Content-Transfer-Encoding: quoted-printable\n";
print MAIL "\n";
print MAIL "we have recieved your email and will respond in due course the email inout will be zen15006\@zen.co.uk\n"
. "";
close(MAIL);
# Embed success page and dump it to the browser
$fileSuccessPage = 'success.html';
if (!(-e $fileSuccessPage)) {
print "Content-type: text/html\n\n";
print 'The success page: <b>success.html</b> cannot be found on the server.';
exit;
}
open(HANDLE, $fileSuccessPage);
@successPage = <HANDLE>;
close(HANDLE);
foreach $pageLine (@successPage) {
$successPage .= $pageLine;
}
$successPage =~ s/<!--FIELDVALUE:name-->/$name/;
$successPage =~ s/<!--FIELDVALUE:email-->/$email/;
$successPage =~ s/<!--FIELDVALUE:Submit-->/$Submit/;
print "Content-type: text/html\n\n";
print $successPage;
exit;
# End of Perl script
thanks
Ian