K2 meeting10-11 May 2016, Porto, Portugal
die();/*
require_once($_SERVER['DOCUMENT_ROOT'] . "/../includes/phpmailer/class.phpmailer.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/../includes/phpmailer/class.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;
$dinner = isset($_POST['dinner']) ? $_POST['dinner'] : NULL;
$foodRestrictions = isset($_POST['foodRestrictions']) ? $_POST['foodRestrictions'] : NULL;
$instituteInvoice = isset($_POST['instituteInvoice']) ? $_POST['instituteInvoice'] : NULL;
$vatInvoice = isset($_POST['vatInvoice']) ? $_POST['vatInvoice'] : NULL;
$addressInvoice = isset($_POST['addressInvoice']) ? $_POST['addressInvoice'] : NULL;
$zipCodeInvoice = isset($_POST['zipCodeInvoice']) ? $_POST['zipCodeInvoice'] : NULL;
$cityInvoice = isset($_POST['cityInvoice']) ? $_POST['cityInvoice'] : NULL;
$countryInvoice = isset($_POST['countryInvoice']) ? $_POST['countryInvoice'] : NULL;
$checkBoxPrivacy = isset($_POST['checkBoxPrivacy']) ? $_POST['checkBoxPrivacy'] : NULL;
$flag_done = isset($_POST['flag_done']) ? $_POST['flag_done'] : NULL;
$double = NULL;
$sqlLimit = "SELECT COUNT(id) FROM `$tablename` WHERE deleted='0'";
$resultLimit = mysql_query($sqlLimit);
$rowLimit = mysql_fetch_row($resultLimit);
if ($rowLimit[0] > 55) $limitReached = TRUE;
else $limitReached = FALSE;
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;
$dinnerEmpty = !$dinner ? 1 : NULL;
$instituteInvoiceEmpty = (!$instituteInvoice && $dinner == 2) ? 1 : NULL;
$vatInvoiceEmpty = (!$vatInvoice && $dinner == 2) ? 1 : NULL;
$addressInvoiceEmpty = (!$addressInvoice && $dinner == 2) ? 1 : NULL;
$zipCodeInvoiceEmpty = (!$zipCodeInvoice && $dinner == 2) ? 1 : NULL;
$cityInvoiceEmpty = (!$cityInvoice && $dinner == 2) ? 1 : NULL;
$countryInvoiceEmpty = (!$countryInvoice && $dinner == 2) ? 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 = htmlentities(mysql_real_escape_string($firstname), ENT_QUOTES);
$lastname_db = htmlentities(mysql_real_escape_string($lastname), ENT_QUOTES);
$institute_db = htmlentities(mysql_real_escape_string($institute), ENT_QUOTES);
$email_db = htmlentities(mysql_real_escape_string($email), ENT_QUOTES);
$foodRestrictions_db = htmlentities(mysql_real_escape_string($foodRestrictions), ENT_QUOTES);
$instituteInvoice_db = htmlentities(mysql_real_escape_string($instituteInvoice), ENT_QUOTES);
$vatInvoice_db = htmlentities(mysql_real_escape_string($vatInvoice), ENT_QUOTES);
$addressInvoice_db = htmlentities(mysql_real_escape_string($addressInvoice), ENT_QUOTES);
$zipCodeInvoice_db = htmlentities(mysql_real_escape_string($zipCodeInvoice), ENT_QUOTES);
$cityInvoice_db = htmlentities(mysql_real_escape_string($cityInvoice), 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 && !$countryEmpty && !$instituteInvoiceEmpty && !$vatInvoiceEmpty && !$addressInvoiceEmpty && !$instituteEmpty && !$dinnerEmpty && !$emailError && !$checkBoxPrivacyEmpty && !$emailAlreadyRegister && !$zipCodeInvoiceEmpty && !$cityInvoiceEmpty && !$countryInvoiceEmpty)
{
if ($limitReached == TRUE) {
$sql = "INSERT INTO `$tablename` VALUES (NULL,
'$firstname_db',
'$lastname_db',
'$email_db',
'$institute_db',
'$country',
'$dinner',
'$foodRestrictions_db',
'$instituteInvoice_db',
'$vatInvoice_db',
'$addressInvoice_db',
'$zipCodeInvoice_db',
'$cityInvoice_db',
'$countryInvoice',
'0',
'0',
'0',
'0'
)";
} else {
$sql = "INSERT INTO `$tablename` VALUES (NULL,
'$firstname_db',
'$lastname_db',
'$email_db',
'$institute_db',
'$country',
'$dinner',
'$foodRestrictions_db',
'$instituteInvoice_db',
'$vatInvoice_db',
'$addressInvoice_db',
'$zipCodeInvoice_db',
'$cityInvoice_db',
'$countryInvoice',
'0',
'0',
'1',
'0'
)";
}
$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 below to register in this conference.
Upon successful submission of the form you will receive a confirmation e-mail.
" ?>
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. Please follow this link to update your registration.";
} elseif ($flag_done) {
$country_mail = sql_ifget_value('country', 'printable_name', 'iso = "' . $country . '"');
if ($dinner == '2') {
$paymentInfo = "
Payment information
";
if ($limitReached == TRUE) {
$paymentInfo .= "The payment information will be sent as soon as your registration is validated.
";
} else {
$paymentInfo .= "The registration must be paid by bank transfer.
We require all international transfers to us to be made with OUR instruction. OUR instruction means you pay all transfer charges.
Please clearly identify your name when doing your transfer, and notify the LOC by e-mail (
Elsa.Silva@astro.up.pt). In your e-mail, if possible please mention the reference code of the transfer (or any clear identifier), or send us a file with the bank's receipt.
Your registration will only be confirmed once we receive full payment of the registration fee.
Account Holder: Centro de Investigação em Astronomia/Astrofísica da Universidade do Porto
Bank Name: Caixa Geral de Depósitos
Bank Adress: Praca Mouzinho de Albuquerque no 113, Edifício Brasília, PT-4100-359 Porto, Portugal
IBAN CODE : PT50 0035 0160 00061936230 05
SWIFT/BIC CODE: CGDIPTPL
";
}
} else {
$paymentInfo = "";
}
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SetFrom("helpdesk@iastro.pt", "Instituto de Astrofísica e Ciências do Espaço");
$mail->AddAddress($email, $firstname . " " . $lastname);
$mail->AddCc("helpdesk@iastro.pt", "Instituto de Astrofisica e Ciências do Espaço");
$mail->AddBcc("Alexandre.Santerne@astro.up.pt", "Alexandre Santerne");
$mail->Subject = "K2 meeting registration acknowledgment";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML("
Dear ". $firstname_db . " ". $lastname_db .",
This is an automated message. Your registration has been successfully submitted.
Thank you.
Name: ".$lastname_db.", ".$firstname_db."
E-mail: ".$email."
Institution: ".$institute_db. "
Country: " . $country_mail . "
" . $paymentInfo . "
Best regards,
K2 meeting LOC");
$mail->Send();
?>
Your registration has been successfully submitted. Thank you.
Information
Name: echo $lastname .", ".$firstname; ?>
E-mail: echo $email; ?>
Affiliation: echo $institute; ?>
echo $paymentInfo; ?>
}
}
if (!$flag_done)
{
?>
echo $textTop ?>
}
?>