session_start(); include("admin/includes/config.php"); include(BASE_DIR."admin/email-html/htmlMimeMail.php"); include('functions.php'); include('header1.php'); $recipent = "lovitt@mitchell-railgear.com"; $uri = $_SERVER['REQUEST_URI']; $pathFromUrl = createPathFromUrl($uri); $bid = (int)$pathFromUrl[1]; if (isset($bid)) { if(isset($_SESSION['brochure_fill_form']) && $_SESSION['brochure_fill_form'] === 1) { $query = mysqli_query($connection,"SELECT `brochure` FROM brochures WHERE brochures_id = ".$bid); $brochure = mysqli_fetch_row($query); $file = BASE_DIR."documents/".$brochure[0]; echo '
'; } else { if ($_POST['getBrochure']) { $nameError = ""; $companyError = ""; $phoneError = ""; $cityError = ""; $stateError = ""; $zipError = ""; $emailError = ""; $addressError = ""; $captchaError = ""; $countryError = ""; $errors = 0; if (!preg_match("|^[-0-9a-z_\.]+@[-0-9a-z_^\.]+\.[a-z]{2,6}$|i", $_POST['email'])) { $emailError = "Email is incorrect!
"; $errors++; } if (empty($_POST['address'])) { $addressError = "Insert your address!
"; $errors++; } if (empty($_POST['name'])) { $nameError = "Insert your name!
"; $errors++; } if (empty($_POST['country'])) { $countryError = "Insert your country!
"; } if (empty($_POST['company'])) { $companyError = "Insert your company name!
"; $errors++; } if (empty($_POST['phone'])) { $phoneError = "Insert your phone number!
"; $errors++; } if (empty($_POST['city'])) { $cityError = "Insert your city!
"; $errors++; } if (empty($_POST['state'])) { $stateError = "Insert your state!
"; $errors++; } if (empty($_POST['zip'])) { $zipError = "Insert your zip number!
"; $errors++; } if ($_POST['captcha'] != strtolower($_SESSION['captcha'])) { $captchaError = "Inserted captcha is incorrect!
"; $errors++; } if ($errors > 0) { $form = "Please, enter your information for brochures download!