";
$hit_count=0;
print "";
print "| LeadID | Phone | Name |
";
while(@record = $sth->fetchrow_array) {
$hit_count = $hit_count + 1;
print "";
print "| $record[0] | ";
print "$record[1] | ";
print "$record[3] | ";
print "";
print "";
print "Edit | ";
print "
";
}
print "
";
$sth->finish;
print "";
#TESTAREA#####################
print "";
}
#####################################
sub env {
print "\n";
foreach $key (sort keys %ENV)
{
print qq|| $key: | $ENV{$key} |
\n|;
}
print "
\n";
}
#############################################################################
sub passback {
print "\n";
foreach $key (sort keys %FORM)
{
print qq|| $key: | $FORM{$key} |
\n|;
}
print "
\n";
}
##########################
sub myerror {
print "";
print "Not implemented yet...\n";
print " |
";
}
##########################
sub fetchit {
if ($ENV{'REQUEST_METHOD'} eq 'GET')
{
@pairs = split(/&/, $ENV{'QUERY_STRING'});
}
elsif ($ENV{'REQUEST_METHOD'} eq 'POST')
{
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
} else {
#&output("Error 112","Bad or Unknown Request Method");
print "Bad or Unknown Request Method";
}
foreach $pair (@pairs)
{
local($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s///g;
$INPUT{$name} = $value;
if (($name =~ /^r_/) && (!$value))
{
push(@missing_fields,$name)
}
if (($name =~ /email/) && ($value) && (($value =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/) ||
($value !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/)))
{
push(@bad_emails,$name)
}
$FORM{$name} = $value;
### BEGIN DEBUG SECTION
# print "Content-type: text/plain\n\n";
# print "In debug mode\n";
# print "$value = $name\n";
# exit;
### END DEBUG SECTION
}
}
##########################
sub mail_user {
open (MAIL, "|$mailprog -t")
|| print "Can't start mail program";
print MAIL "To: $email\n";
print MAIL "From: newuser\@dynx.net (DynX Services)\n";
print MAIL "Subject: New User Information\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "Your request for a DynX Account was Successful. \n";
print MAIL "As soon as your request is processed, you will be \n";
print MAIL "notified by email that you can login. \n\n";
print MAIL "Username: $username \n";
print MAIL "Password: $password \n\n";
print MAIL "You should file this away somewhere safe! \n";
print MAIL "\n\n";
close (MAIL);
}
##########################
sub mail_dynx {
open (MAIL, "|$mailprog -t")
|| print "Can't start mail program";
print MAIL "To: pchammer\@dynx.net\n";
print MAIL "From: newuser\@dynx.net (DynX Services)\n";
print MAIL "Subject: New User Information\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "The following user has signed up for DynX Services. \n";
print MAIL "Username: $username \n";
print MAIL " Email: $email \n\n";
print MAIL "\n\n";
close (MAIL);
}
##########################
sub getdate {
my $sth = $dbh->prepare("SELECT LEFT(NOW(),8)");
$sth->execute;
( $now ) = $sth->fetchrow();
$now =~ s/://g;
$now =~ s/-//g;
$now =~ s/\s//g;
return $now;
}
##########################
sub getdatetime {
my $sth = $dbh->prepare("SELECT NOW()");
$sth->execute;
( $now ) = $sth->fetchrow();
$now =~ s/://g;
$now =~ s/-//g;
$now =~ s/\s//g;
return $now;
}
#########################
sub error {
local($errornum, $error) = @_;
print "The Following Errors Were Encountered!";
print "
ERROR CODE: $errornum";
print "
ERROR TYPE: $error
";
print "Press your browser's BACK button to Go back to the form and fix them. Thank you.";
print "
$footer";
exit;
}
#*************************