<?php
$firstname = $_POST['FirstName'];
$lastname = $_POST['Lastname'];
$date = $_POST['Date'];
$month = $_POST['Months'];
$year = $_POST['Year'];
$Gender = $_POST['Gender'];
$country = $_POST['Country'];
$Province = $_POST['ProvinceStateRegion'];
$CityTown = $_POST['CityTown'];
$emailaddress = $_POST['EmailAddess'];
$lookingfor = $_POST['LookingFor'];
$interestedin = $_POST['InterestedIn'];
$Duration = $_POST['Duration'];
$tnc_agree = $_POST['tnc_agree'];
$to = "ContiAds! <you@your_domain.com>"; // put here the email address you want this sent to
$subject = "New ContiAds SignUp!";
$body = "<html>".
"<head>".
"<title>Contact Request</title>".
"<style type='text/css'>".
"body,td,th {".
"font-family: Geneva, Arial, Helvetica, sans-serif;".
"font-size: 12px;".
"}".
".style1 {font-size: 24px}".
"</style></head>".
"<body>".
"<p align='center' class='style1'>ContiAds New Signup</p>".
"<table width='498' border='0' align='center' cellpadding='5' cellspacing='0'>".
"<tr>".
"<td colspan='2' valign='top' bgcolor='#333333' height='2px'></td>".
"</tr>".
"<tr>".
"<td width='104' valign='top'>Full Name:</td>".
"<td width='374'>".$firstname." ".$lastname."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Date:</td>".
"<td>".$date."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Month:</td>".
"<td>".$month."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Year:</td>".
"<td>".$year."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Gender:</td>".
"<td>".$Gender."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Country:</td>".
"<td>".$country."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Province:</td>".
"<td>".$Province."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Email Address:</td>".
"<td>".$emailaddress."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Looking For:</td>".
"<td>".$lookingfor."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Interested In:</td>".
"<td>".$interestedin."</td>".
"</tr>".
"<tr>".
"<td valign='top'>Duration:</td>".
"<td>".$Duration."</td>".
"</tr>".
"<tr>".
"<td colspan='2' valign='top' bgcolor='#333333' height='2px'></td>".
"</tr>".
"</table>".
"</body>".
"</html>";
//Always set content-type when sending HTML email
$rand = md5( time() );
$mime_boundary = '==Multipart_Boundary_' . $rand;
$headers = "From: " . $emailaddress . "\n" .
"Reply-To:" . $emailaddress . "\n" .
"MIME-Version: 1.0\n" .
"Content-Type: multipart/mixed; boundary=\"" . $mime_boundary . "\"";
"\n\n";
$message = "This is a multi-part message in MIME format.\n\n" .
"--" . $mime_boundary . "\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$body . "\n\n";
// Add file attachment to the message
$path = '/home/suomedia/public_html/images/'; // the path to upload images (must be writable)
$filepath = $path . basename( $_FILES['Picture']['name']);
$len = strlen($_FILES['Picture']['name']) - 4;
$extension = substr($_FILES['Picture']['name'],$len); // get the file extension
$permitted = array('.jpg', '.JPG', '.PNG', '.png', '.GIF', '.gif'); // only allow these file extensions
$success = false;
if (in_array($extension, $permitted)) {
if(move_uploaded_file($_FILES['Picture']['tmp_name'], $filepath)) {
$success = true;
$fileatt_type = 'image/' . strtoupper(ltrim($extension, '.'));
$picture_name = $_FILES['Picture']['name'];
$file = fopen( $filepath, 'rb' );
$data = fread( $file, filesize( $filepath ) );
fclose( $file );
$data = chunk_split( base64_encode( $data ) );
$message .= "--" . $mime_boundary . "\n" .
"Content-Type: \"" . $fileatt_type . "\";\n" .
" name=\"" . $picture_name . "\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"" . $picture_name . "\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--" . $mime_boundary . "--\n";
} else {
$success = false;
}
} else {
$success = false;
}
// end file attachment
if($success == true) {
if (mail($to, $subject, $message, $headers)) {
?>
<script language="javascript" type="text/javascript">
location.replace("Sign%20Up%20Success.htm");
</script>
<?php
} else {
?>
<script language="javascript" type="text/javascript">
location.replace("Sign%20Up%20Failure.htm");
</script>
<?php
}
} else {
?>
<script language="javascript" type="text/javascript">
location.replace("Sign%20Up%20Failure.htm");
</script>
<?php
}
?>