<?php
if (isset ($_POST['contactFF'])) { $to = "mail@net"; // поменять на свой адрес
$from = $_POST['contactFF'];
$subject = "Заполнена заявка с ".$_SERVER['HTTP_REFERER'];
$message = "Имя: ".$_POST['nameFF']."\nEmail: ".$from."\nIP: ".$_SERVER['REMOTE_ADDR']."\nДетали заявки: ".$_POST['messageFF'];
$filesize = '';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: " . $from . "\r\n";
$headers .= "Reply-To: " . $from . "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n";
$message="
Content-Type: multipart/mixed; boundary=\"$boundary\"
--$boundary
Content-Type: text/plain; charset=\"utf-8\"
Content-Transfer-Encoding: 7bit
$message";
for($i=0;$i<count($_FILES['fileFF']['name']);$i++) {
$filename = $_FILES['fileFF']['name'][$i];
$filetype = $_FILES['fileFF']['type'][$i];
$filesize .= $_FILES['fileFF']['size'][$i];
$message.="
--$boundary
Content-Type: \"$filetype\"; name=\"$filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=\"$filename\"
$attachment";
}
}
$message.="
--$boundary--";
if ($filesize < 10000000) { // проверка на общий размер всех файлов. Многие почтовые сервисы не принимают вложения больше 10 МБ
mail($to, $subject, $message, $headers); $output = '<script>alert("Ваша заявка отправлена, спасибо, я свяжусь с вами в ближайшее время!");</script>';
} else {
$output = '<script>alert("Извините, письмо не отправлено. Размер всех файлов превышает 10 МБ.");</script>';
}
}
?>
<html lang="ru">
<head>
<meta charset="utf-8">
<?php include ('css.php');?>
</head>
<?php echo $output; ?>
<body>
<div class="container">
<div class="stepwizard">
<div class="stepwizard-row setup-panel">
<div class="stepwizard-step">
<a href="#step-1" type="button" class="btn btn-primary btn-circle">1</a>
<p>Step 1</p>
</div>
<div class="stepwizard-step">
<a href="#step-2" type="button" class="btn btn-default btn-circle" disabled="disabled">2</a>
<p>Step 2</p>
</div>
<div class="stepwizard-step">
<a href="#step-3" type="button" class="btn btn-default btn-circle" disabled="disabled">3</a>
<p>Step 3</p>
</div>
</div>
</div>
<form enctype="multipart/form-data" method="POST" id="feedback-form">
<!--<form id="contactForm" class="well" enctype="multipart/form-data" name="sentMessage">-->
<div class="row setup-content" id="step-1">
<div class="col-xs-12">
<div class="col-md-12">
<h3> Step 1</h3>
<div class="form-group">
<label class="control-label">First Name</label>
<input maxlength="100" name="nameFF" id="nameFF" type="text" required="required" class="form-control" placeholder="Enter First Name" />
</div>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Продолжыть</button>
</div>
</div>
</div>
<div class="row setup-content" id="step-2">
<div class="col-xs-12">
<div class="col-md-12">
<h3> Step 2</h3>
<div class="form-group">
<label class="control-label">Email Address</label>
<input maxlength="200" type="email" name="contactFF" id="contactFF" required="required" class="form-control" placeholder="Enter Company Address" />
</div>
<button type="button" class="btn btn-primary prevBtn btn-lg pull-left">Назад</button>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Проверка данных</button>
</div>
</div>
</div>
<div class="row setup-content" id="step-3">
<div class="col-xs-12">
<div class="col-md-12">
<h3> Step 3</h3>
<label for="fileFF"><strong>Прикрепить фотографию:</strong></label>
<input type="file" name="fileFF[]" multiple id="fileFF" class="w100">
<button type="button" class="btn btn-primary prevBtn btn-lg pull-left">Назад</button>
<button class="btn btn-primary pull-right" type="submitFF" >Send message</button>
<div id="success"><p class="help-block"></p></div>
</div>
</div>
</div>
</form>
</div>
<?php include ('js.php');?>
</body>
</html>