package SPA2017winterGETID;
my $path="../../../";
my $apath="./";
my $title="Online Abstract Submission";
my $header = $title;
!>
#include ../../../includes/wp-spa-header.iphtml
#include ./includes/abstract_header.iphtml
my %States=0;
my $Current_Screen=0;
my $email_problem;
my $complete=1;
my $foo;
# my $incomplete=0;
%States = (
'Default' => \&first_page,
'Submit' => \&submit_page,
);
$Current_Screen = $main::cgi->param("Submit") || "Default";
die "No screen for $Current_Screen" unless $States{$Current_Screen};
# if ($Current_Screen eq "Submit") {
# ($complete, $foo) = check_required(1, "c_");
# print "
$foo
";
# }
# if (!$complete) {
# $Current_Screen = "Default";
# }
while (my($screen_name, $function) = each %States) {
$function->($screen_name eq $Current_Screen);
}
# lprint "INCOMPLETE = $incomplete
\n";
# &first_page($incomplete, $incomplete);
sub first_page {
# if ($Current_Screen eq "Default") {
my $active = shift;
return unless $active;
$email_problem = shift;
# print "BEGIN FIRST_PAGE
\n";
foreach (keys %errors) {
# print $_ . " ==> " . $errors{$_} . "
\n";
$errors{$_} = 0;
}
if ($main::cgi->param('Submit') eq "Submit") {
($complete, $foo) = check_required(1, "c_");
}
my $complete2 = 1;
if ($main::cgi->param('c_email') ne $main::cgi->param('c_email2')) {
$complete2 = 0;
}
# my $r_error = 0;
# $r_error = shift;
# my %required_errors = %{$r_error};
!>
In order to submit abstracts online you must have a login ID.
If you already have a login ID, but have forgotten your password please visit the Lost Password Page
To obtain a login ID please fill out the following information.
Your login ID will be the email address you enter into this form.
Please note that the Primary Contact is the only person who will receive communications regarding the abstract status.
} # end first page
sub submit_page {
# if ($Current_Screen eq "Submit") {
my $active = shift;
return unless $active;
# print "BEGIN SUBMIT_PAGE
\n";
# foreach ($main::cgi->param) {
# print $_ . "==>" . $main::cgi->param($_) . "
\n";
# }
# my $complete=1;
# check required fields
my ($complete, $foo) = check_required(1, "c_");
if ($main::cgi->param('c_email') ne $main::cgi->param('c_email2')) {
$complete = 0;
print "Please type your email address the same both times
";
}
# my $foo;
# my ($complete, %required_errors) = check_required(1, "c_", \%errors);
# print "FOO from Check_Required:
\n$foo";
# foreach (keys %required_errors) {
# # print $_ . " ==> " . $required_errors->{$_} . "
\n";
# print $_ . " ==> " . $required_errors{$_} . "
\n";
# }
# $complete=0;
# $errors{"c_fname"} = "1";
if (!$complete) {
first_page(1);
return;
}
# check for duplicate username first
my $SQL = "SELECT COUNT(username) FROM primary_contacts WHERE username = \"" . $main::cgi->param("c_email") . "\"";
# print "SQL=" . $SQL;
my $cursor = $main::dbh->prepare($SQL);
my $connum = time();
$cursor->execute;
my $count = $cursor->fetchrow;
$cursor->finish;
# $count=1;
if ($count > 0) {
# $email_problem = 1;
first_page(1,1);
return;
}
# insert data into the primary_contacts table
my $table = "primary_contacts";
my $values = ") VALUES (";
$SQL="INSERT INTO $table(";
foreach ($main::cgi->param) {
next if (($_ eq "Submit") || ($_ =~ m/c_email/));
my $field_name = $_;
my $prefix = $table_prefix{$table};
$values .= $main::dbh->quote($main::cgi->param($field_name)) . ", ";
$field_name =~ s/$prefix//;
$SQL .= "$field_name, ";
}
$SQL .= "username, conID" . $values . $main::dbh->quote($main::cgi->param("c_email")) . ", \"$connum\")";
# print "SQL=$SQL
\n";
my $cursor = $main::dbh->prepare($SQL);
$cursor->execute;
my $affected = $cursor->rows;
$cursor->finish;
# print "AFFECTED=$affected";
if ($affected == 1) {
!>
Login ID Created!
# send confirmation email
my $email = $main::cgi->param('c_email');
my $sender = $society . "_abstracts\@societyhq.com";
#my $bcc = "leonard\@societyhq.com, gwen\@societyhq.com"; now defined in abstract_header
my $subject = uc($society) . " Online Abstract Registration";
my $URL = $ENV{"SCRIPT_SRC_URL"};
my $script = $ENV{"SCRIPT_SRC_URL_FILE"};
$URL =~ s/$script//;
$URL .= "confirm.iphtml";
my $confirmURL = $URL . "?conID=" . $connum . "&email=" .$main::cgi->escape($email);
my $IP = $ENV{"REMOTE_ADDR"};
# print "
$confirmURL
";
# foreach (%ENV) {
# print $_ . " ==> " . $ENV{$_} . "
";
# }
open (MAIL, "|/usr/lib/sendmail -oi -t") or die "can't fork sendmail: $!";
print MAIL <
Thank you.
You must now confirm your registration. An email has been sent to =$email!> with further instructions.
} else {
# login id not created
print "ERRORLogin ID NOT Created. Please contact $society\@societyhq.com";
}
!>
} # end submit page
!>
#include ./includes/abstract_footer.iphtml
#include ../../../includes/wp-spa-footer.iphtml