Wrong captcha! please, try again.
';
}
if($text_captcha == 1){
if($_POST['nombre'] == ''){
$error1 = 'Insert your first name, please';
}else if($_POST['apellido'] == ''){
$error2 = 'Insert your last name, please';
}else if($_POST['email'] == '' or !preg_match("/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/",$_POST['email'])){
$error3 = 'Invalid e-mail!';
}else if($_POST['affiliation'] == ''){
$error4 = 'Insert an affiliation, please';
}else if(empty($_POST['talk'])){
$error5 = 'Will you present a talk? yes or not?';
}else{
$dest = "fof@oac.uncor.edu"; //Email de destino
$nombre = $_POST['nombre'];
$apellido = $_POST['apellido'];
$email = $_POST['email'];
$affiliation = $_POST['affiliation'];
$talk = $_POST['talk'];
if($_POST['topic'] == 'Choose...' or $_POST['topic'] == 'Other'){
$topic = $_POST['new_topic'];
}else{
$topic = $_POST['topic'];
}
$asunto = "Inscription $nombre $apellido";
//Cabeceras del correo
$header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
$header1 = '=?UTF-8?B?'.base64_encode($nombre . $apellido).'?=';
$header = "From: " . $header1; //Quien envia?
$headers = $header_ . $header;
$cuerpo = "Inscription:\n\n";
$cuerpo .= "First name: $nombre\n\n";
$cuerpo .= "Last name: $apellido\n\n";
$cuerpo .= "E-mail: $email\n\n";
$cuerpo .= "Affiliation: $affiliation\n\n";
$cuerpo .= "Talk: $talk\n\n";
$cuerpo .= "Topic: $topic\n\n";
if(mail($dest,'=?UTF-8?B?'.base64_encode($asunto).'?=',$cuerpo,$headers)){
$cuerpo = "FoF Meeting 2014\n\n";
$cuerpo .= "Your pre-inscription was processed succefully.\n\n";
$cuerpo .= "Kind regards, LOC.-\n";
$cuerpo .= "http://fof.oac.uncor.edu\n";
$headers = 'From: FoF2014' . "\r\n" .
'Reply-To: fof@oac.uncor.edu' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email,"FoF 2014 Inscription",$cuerpo,$headers);
$result = 'Email sent successfully :)
';
$file = "/var/www/webs/data.txt";
$fp = fopen($file, 'a') or die("Couldn't open $file for writing!");
$cuerpo = "$nombre $apellido $affiliation $email Talk: $talk\n";
fwrite($fp, $cuerpo);
fclose($fp);
//reseteamos
$_POST['nombre'] = '';
$_POST['apellido'] = '';
$_POST['email'] = '';
$_POST['affiliation'] = '';
$_POST['talk'] = '';
$_POST['new_topic'] = '';
}else{
$result = 'Error while sending email :(
';
}
}
}
}
?>