<!-- Layout -->
 <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<?php
/* Valores recebidos do formulário  */
$attachment = $_FILES['attachment'];/* 01 P*/
$groupattendees = $_POST['groupattendees'];/* 02 P*/
$individualattendees = $_POST['individualattendees'];
$numberofparticipants = $_POST['numberofparticipants'];
$radio1=$_POST['radio1'];
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$streetaddress=$_POST['streetaddress'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$whatsapp = $_POST['whatsapp'];
$replyto = $_POST['replyto']; // Email que será respondido 
$persontocontact = $_POST['persontocontact'];
$country_1 = $_POST['country_1'];
$radio2=$_POST['radio2'];
$radio3=$_POST['radio3'];
$arrivaldate_1=$_POST['arrivaldate_1'];
$arrivaldate_2=$_POST['arrivaldate_2'];
$arrivaldate_3=$_POST['arrivaldate_3'];
$arrivaldate_4=$_POST['arrivaldate_4'];


$name_attendees = $_POST['name_attendees'];
$occupation = $_POST['occupation'];
$employer = $_POST['employer'];


$radio3=$_POST['radio3'];
$event_1=$_POST['event_1'];
$event_2=$_POST['event_2'];
$eventtheme_1=$_POST['eventtheme_1'];
$eventtheme_2=$_POST['eventtheme_2'];
$eventtheme_3=$_POST['eventtheme_3'];
$eventtheme_4=$_POST['eventtheme_4'];
$eventtheme_5=$_POST['eventtheme_5'];
$eventtheme_6=$_POST['eventtheme_6'];
$eventtheme_7=$_POST['eventtheme_7'];
$eventtheme_8=$_POST['eventtheme_8'];
$eventpainel_1=$_POST['eventpainel_1'];
$eventpainel_2=$_POST['eventpainel_2'];
$roundtable_1=$_POST['roundtable_1'];
$roundtable_2=$_POST['roundtable_2'];
$roundtable_3=$_POST['roundtable_3'];
$roundtable_4=$_POST['roundtable_4'];
$businessforum=$_POST['businessforum'];
$businessround=$_POST['businessround'];
$businessforum_1=$_POST['businessforum_1'];
$businessforum_2=$_POST['businessforum_2'];
$businessforum_3=$_POST['businessforum_3'];
$businessforum_4=$_POST['businessforum_4'];
$businessforum_5=$_POST['businessforum_5'];
$businessforum_6=$_POST['businessforum_6'];
$businessforumpanel_1=$_POST['businessforumpanel_1'];
$businessforumpanel_2=$_POST['businessforumpanel_2'];
// EVENT: business round
$businessround_1=$_POST['businessround_1'];
$businessround_2=$_POST['businessround_2'];
$businessround_3=$_POST['businessround_3'];
$businessround_4=$_POST['businessround_4'];
$businessround_5=$_POST['businessround_5'];
$businessround_6=$_POST['businessround_6'];
$businessround_7=$_POST['businessround_7'];
// EVENT: Dates of Participation planning
$planning_1=$_POST['planning_1'];
$planning_2=$_POST['planning_2'];
$planning_3=$_POST['planning_3'];
$planning_4=$_POST['planning_4'];
$planning_5=$_POST['planning_5'];
//Event packages
$pack_1=$_POST['pack_1'];
$pack_2=$_POST['pack_2'];
$pack_3=$_POST['pack_3'];
$radio4=$_POST['radio4'];
$radio5=$_POST['radio5'];
$island=$_POST['island'];
//Need accommodation
$radio6=$_POST['radio6'];
// Need accommodation ?
$accommodationevent_1=$_POST['accommodationevent_1'];
$accommodationevent_2=$_POST['accommodationevent_2'];
$accommodationevent_3=$_POST['accommodationevent_3'];
$accommodationevent_4=$_POST['accommodationevent_4'];
$accommodationevent_5=$_POST['accommodationevent_5'];
$accommodationevent_6=$_POST['accommodationevent_6'];
$accommodationevent_7=$_POST['accommodationevent_7'];
$accommodationevent_8=$_POST['accommodationevent_8'];
$accommodationevent_9=$_POST['accommodationevent_9'];
$accommodationevent_10=$_POST['accommodationevent_10'];
//Need transit support in Dakar
$radio7=$_POST['radio7'];
$dakar_1=$_POST['dakar_1'];
$dakar_2=$_POST['dakar_2'];
$dakar_3=$_POST['dakar_3'];
$dakar_4=$_POST['dakar_4'];
//Need transit support in Lisbon
$radio8=$_POST['radio8'];
$lisbon_1=$_POST['lisbon_1'];
$lisbon_2=$_POST['lisbon_2'];
$lisbon_3=$_POST['lisbon_3'];
$lisbon_4=$_POST['lisbon_4'];
//Need flights ?
$radio9=$_POST['radio9'];
//If yes choose country of departure
$country_2=$_POST['country_2'];
//Do you need A/V equipment?
$radio10=$_POST['radio10'];
$equipment_1=$_POST['equipment_1'];
$equipment_2=$_POST['equipment_2'];
$equipment_3=$_POST['equipment_3'];
$equipment_4=$_POST['equipment_4'];
//Acceptance of terms and conditions
$agree=$_POST['agree'];



$subject = $_POST['subject'];

$message_form = $_POST['message_form'];

 
/* Destinatário e remetente - EDITAR SOMENTE ESTE BLOCO DO CÓDIGO */
$to = "info@boxtravel.eu";
$remetente = "info@basaltconference.com"; // Deve ser um email válido do domínio
 
/* Cabeçalho da mensagem  */
$boundary = "XYZ-" . date("dmYis") . "-ZYX";
$headers = "MIME-Version: 1.0\n";
$headers.= "From: $remetente\n";
$headers.= "Reply-To: $replyto\n";
$headers.= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n";  
$headers.= "$boundary\n"; 
/* Layout da mensagem  */
$body_message = " 
<br>BASALT CONFERENCE
<br>--------------------------------------------<br>
<br><strong>Attendees category::</strong> $groupattendees
<br><strong>Attendees category:</strong> $individualattendees
<br><strong>Number of participants:</strong> $numberofparticipants
<br><strong>Visa need ?</strong> $radio1
<br><strong>First Name: </strong> $firstname
<br><strong>Last Name: </strong> $lastname
<br><strong>Street Address: </strong> $streetaddress
<br><strong>Street Address Line 2:</strong> $address
<br><strong>Phone Number:</strong> $phone
<br><strong>WhatsApp / Viber:</strong> $whatsapp
<br><strong>E-mail:</strong> $replyto
<br><strong>Person to contact:</strong> $persontocontact
<br><strong>Participant country :</strong> $country_1
<br><strong>Lunch need:</strong> $radio2
<br><strong>Dinner need:</strong> $radio3
<br><strong>Arrival date :</strong> $arrivaldate_1
<br><strong>Return date :</strong> $arrivaldate_2
<br><strong>Arrival Time :</strong> $arrivaldate_3
<br><strong>Departure time :</strong> $arrivaldate_4


<br><strong>Group participant:</strong> $radio2
<br><strong>Name of Attendees:</strong> $name_attendees
<br><strong>Occupation :</strong> $occupation
<br><strong>Employer :</strong> $employer


<br><strong>Need for food:</strong> $radio3
<br><strong>Basalt Conference:</strong> $event_1
<br><strong>Basalt Round Table:</strong> $event_2
<br><strong>Conference I:</strong> $eventtheme_1
<br><strong>Conference II:</strong> $eventtheme_2
<br><strong>Conference III:</strong> $eventtheme_3
<br><strong>Conference IV:</strong> $eventtheme_4
<br><strong>Conference V:</strong> $eventtheme_5
<br><strong>Conference VI:</strong> $eventtheme_6
<br><strong>Conference VII:</strong> $eventtheme_7
<br><strong>Conference VIII:</strong> $eventtheme_8
<br><strong>Conference painel I:</strong> $eventpainel_1
<br><strong>Conference painel II:</strong> $eventpainel_2
<br><strong>Round Table Theme I:</strong> $roundtable_1
<br><strong>Round Table Theme II:</strong> $roundtable_2
<br><strong>Round Table Theme III:</strong> $roundtable_3
<br><strong>Round Table Theme IV:</strong> $roundtable_4
<br><strong>Atlantic Business Forum:</strong> $businessforum
<br><strong>Atlantic Business Round:</strong> $businessround
<br><strong>Business opportunities in Ecowas:</strong> $businessforum_1
<br><strong>The TIC: ECOWAS market as a Case Study:</strong> $businessforum_2
<br><strong>Access to the ECOWAS Preferential Market:</strong> $businessforum_3
<br><strong>Access to the AGOA Preferential Market:</strong> $businessforum_4
<br><strong>Access to the EU Preferential Market:</strong> $businessforum_5
<br><strong>BRAZIL – Tech and Entrepreneurial Cooperation:</strong> $businessforum_6
<br><strong>Private Sector Financing in ECOWAS:</strong> $businessforumpanel_1
<br><strong>Stock Market and Venture Capital:</strong> $businessforumpanel_2
<br><strong>Taxation and tax incentives for companies:</strong> $businessround_1
<br><strong>Conditions for Importing and exporting:</strong> $businessround_2
<br><strong>Business opportunities in Cape Verde:</strong> $businessround_3
<br><strong>Session of presentation of projects:</strong> $businessround_4
<br><strong>Session of presentation of services:</strong> $businessround_5
<br><strong>Session of presentation of partnership:</strong> $businessround_6
<br><strong>Business round table:</strong> $businessround_7
<br><strong>Event Date:</strong> $planning_1
<br><strong>Arrival date in Cape Verde:</strong> $planning_2
<br><strong>Return date from Cape Verde:</strong> $planning_3
<br><strong>Event Start Time:</strong> $planning_4
<br><strong>Event End Time:</strong> $planning_5
<br><strong>Full event package:</strong> $pack_1
<br><strong>Agricultural producers and researchers:</strong> $pack_2
<br><strong>Academics and student:</strong> $pack_3
<br><strong>The welcome tours program:</strong> $radio4
<br><strong>The leisure program:</strong> $radio5
<br><strong>The leisure program:</strong> $island
<br><strong>Need accommodation:</strong> $radio6
<br><strong>Hotel:</strong> $accommodationevent_1
<br><strong>Apartment:</strong> $accommodationevent_2
<br><strong>Individual booking (less than 10 pax):</strong> $accommodationevent_3
<br><strong>Group booking (from 10 pax):</strong> $accommodationevent_4
<br><strong>Single bedroom:</strong> $ccommodationevent_5
<br><strong>Accommodation only:</strong> $accommodationevent_6
<br><strong>Room + Brearfast:</strong> $accommodationevent_7
<br><strong>Half pension:</strong> $accommodationevent_8
<br><strong>Full pension:</strong> $accommodationevent_9
<br><strong>All-In:</strong> $accommodationevent_10
<br><strong>Do you need transit support in Dakar ?</strong> $radio7
<br><strong>Accommodation:</strong> $dakar_1
<br><strong>Transfers :</strong> $dakar_2
<br><strong>Food :</strong> $dakar_3
<br><strong>Tours :</strong> $dakar_4
<br><strong>Do you need transit support in Lisbon ?</strong> $radio8
<br><strong>Accommodation:</strong> $lisbon_1
<br><strong>Transfers :</strong> $lisbon_2
<br><strong>Food :</strong> $lisbon_3
<br><strong>Tours :</strong> $lisbon_4
<br><strong>Need flights ?</strong> $radio9
<br><strong>Country of departure :</strong> $country_2
<br><strong>Do you need A/V equipment ?</strong> $radio10
<br><strong>TV & VCR Combo :</strong> $equipment_1
<br><strong>TV & DVD Combo :</strong> $equipment_2
<br><strong>Overhead Projector :</strong> $equipment_3
<br><strong>Sound Equipment :</strong> $equipment_4
<br><strong>Acceptance of terms and conditions :</strong> $agree

<br><strong>Event date:</strong> $eventdate
<br><strong>Event start time:</strong> $event_stime
<br><strong>Event end time:</strong> $event_etime
<br><strong>Subject:</strong> $subject
<br><strong>I agree with:</strong> $agree
<br><strong>Message:</strong> $message_form
<br><br>--------------------------------------------
";
 
/* Função que codifica o anexo para poder ser enviado na mensagem  */
if(file_exists($attachment["tmp_name"]) and !empty($attachment)){
 
    $fp = fopen($_FILES["attachment"]["tmp_name"],"rb"); // Abri o arquivo enviado.
 $attachment = fread($fp,filesize($_FILES["attachment"]["tmp_name"])); // Le o arquivo aberto na linha anterior
 $attachment = base64_encode($attachment); // Codifica os dados com MIME para o e-mail 
 fclose($fp); // Fecha o arquivo aberto anteriormente
    $attachment = chunk_split($attachment); // Divide a variável do arquivo em pequenos pedaços para poder enviar
    $message = "--$boundary\n"; // Nas linhas abaixo possuem os parâmetros de formatação e codificação, juntamente com a inclusão do arquivo anexado no corpo da mensagem
    $message.= "Content-Transfer-Encoding: 8bits\n"; 
    $message.= "Content-Type: text/html; charset=\"utf-8\"\n\n";
    $message.= "$body_message\n"; 
    $message.= "--$boundary\n"; 
    $message.= "Content-Type: ".$attachment["type"]."\n";  
    $message.= "Content-Disposition: attachment; filename=\"".$attachment["name"]."\"\n";  
    $message.= "Content-Transfer-Encoding: base64\n\n";  
    $message.= "$attachment\n";  
    $message.= "--$boundary--\r\n"; 
}
 else // Caso não tenha anexo
 {
 $message = "--$boundary\n"; 
 $message.= "Content-Transfer-Encoding: 8bits\n"; 
 $message.= "Content-Type: text/html; charset=\"utf-8\"\n\n";
 $message.= "$body_message\n";
}
/* Função que envia a mensagem  */
if(mail($to, $subject, $message, $headers))
{
echo "<script>location.href='https://www.basaltconference.com/register/online/hotels/cssform/php/thanks.php'</script>"; // Página que será redirecionada
 //echo "<br><br><center><b><font color='green'>Mensagem enviada com sucesso!";
} 
 else
 {
 echo "<br><br><center><b><font color='red'>An error occurred while sending the message!";
}
?>