TROY meeting I23-24 July 2018, Porto, Portugal
die();
exit();
//-----------------------------------------------------------------
require_once($_SERVER['DOCUMENT_ROOT'] . "/../includes/smtp.php");
$date = date("Ymd");
$tablename=$confAcronym . "_reg";
// Criar o objecto
$firstname = isset($_POST['firstname']) ? $_POST['firstname'] : NULL;
$lastname = isset($_POST['lastname']) ? $_POST['lastname'] : NULL;
$email = isset($_POST['email']) ? $_POST['email'] : NULL;
$institute = isset($_POST['institute']) ? $_POST['institute'] : NULL;
$country = isset($_POST['country']) ? $_POST['country'] : NULL;
$checkBoxPrivacy = isset($_POST['checkBoxPrivacy']) ? $_POST['checkBoxPrivacy'] : NULL;
$flag_done = isset($_POST['flag_done']) ? $_POST['flag_done'] : NULL;
$double = NULL;
if (isset($_POST['submit']) && $_POST['submit']) {
// Verificação dos resultados
$firstnameEmpty = !$firstname ? 1 : NULL;
$lastnameEmpty = !$lastname ? 1 : NULL;
$emailEmpty = !$email ? 1 : NULL;
$instituteEmpty = !$institute ? 1 : NULL;
$countryEmpty = !$country ? 1 : NULL;
$query = "SELECT id FROM `$tablename` WHERE email = '$email'";
$emailVerify = mysql_num_rows(mysql_query($query));
$checkBoxPrivacyEmpty = !isset($_POST['checkBoxPrivacy']) ? 1 : NULL;
$emailError= !ereg("[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]", $email) ? 1: NULL;
// remover caracteres estranhos
$firstname_db = html_entity_decode(htmlentities(mysql_real_escape_string($firstname), ENT_QUOTES));
$lastname_db = html_entity_decode(htmlentities(mysql_real_escape_string($lastname), ENT_QUOTES));
$institute_db = html_entity_decode(htmlentities(mysql_real_escape_string($institute), ENT_QUOTES));
if ($emailVerify > 0) {
$emailAlreadyRegister = 1;
} else {
$emailAlreadyRegister = NULL;
}
// introdução dos valores na base de dados em caso de nao existencia de erro
if (!$firstnameEmpty && !$lastnameEmpty && !$emailEmpty && !$positionEmpty && !$instituteEmpty && !$emailError && !$typeError && !$emailError && !$checkBoxPrivacyEmpty && !$emailAlreadyRegister && !$accommodationEmpty)
{
$sql = "INSERT INTO `$tablename` VALUES (NULL,
'$firstname_db',
'$lastname_db',
'$email',
'$institute_db',
'$country',
'0',
'0',
'empty',
'empty',
'empty'
)";
$result = mysql_query($sql);
if (!$result) die(mysql_error() . "
" . $sql);
$flag_done=1;
} else $textError = "
There was a problem with your registration, please verify the marked fields.
";
}
$textTop="
Please fill the form to register for this meeting.
" ?>
if ((isset($_POST['submit']))){
if (isset($textError)) $textTop.= $textError;
if (isset($emailError)) $textTop.="
Please insert a valid email address!";
if (isset($emailAlreadyRegister)) {
$textTop.="
This email is already registered.";
} elseif ($flag_done) {
$country_mail = $country;
$mail = new smtp();
$mail_conn = $mail->openConnection();
if (!$mail_conn) die ("Connection to SMTP unavailable.");
$mail->setFrom("helpdesk@iastro.pt");
$mail->setFromName("Troy meeting 2018");
$mail->setSubject("Troy meeting 2018 Conference registration acknowledgment");
$mail->setTo($email);
$mail->setCc("helpdesk@iastro.pt");
$mail->setMessage("
Dear ". $firstname . " ". $lastname .",
This is an automated message. Your registration has been successfully submitted. \n
Thank you.
Name: ".$lastname.", ".$firstname."
E-mail: ".$email."
Institution: ".$institute. "
Country: " . $country_mail . "
Best regards,
Troy meeting 2018 Conference LOC");
$mail->send();
?>
Your registration has been successfully submitted. Thank you.
Information
Name: echo $lastname .", ".$firstname; ?>
E-mail: echo $email; ?>
Affiliation: echo $institute; ?>