nord vpnnord vpn
Ad

Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
3.2 kB
2
Indexable
Never
<section class="formularz-metamorfozacollagen">
		
	<?php
	if($_SERVER["REQUEST_METHOD"] == "POST"){
		$email = $_POST['email'];
		$age = $_POST['age'];
		$skinProblem = $_POST['skinProblem'];
		$smoking = $_POST['smoking'];
		$solarium = $_POST['solarium'];
		$suntan = $_POST['suntan'];
		$pregnancy = $_POST['pregnancy'];
		$collagen = $_POST['collagen'];
		$file = $_FILES['file']['name'];
		$file_tmp = $_FILES['file']['tmp_name'];  // get temporary file path
		$file_type = $_FILES['file']['type']; // get file MIME type

		// validate file type
		$allowed_types = ['image/jpeg', 'image/png', 'image/gif'];
		if (!in_array($file_type, $allowed_types)) {
			die('Nieprawidłowy typ pliku. Można przesyłać tylko pliki JPEG, PNG i GIF.');
		}

		// Upload file
		$upload_dir = 'uploads/metamorfozacollagen/';
		if (!is_dir($upload_dir)) {
			mkdir($upload_dir, 0777, true);
		}
		move_uploaded_file($file_tmp, $upload_dir . $file);

		$file_link = "http://mybestpharm.com/".$upload_dir . $file;

		$to = 'zgloszenia@mybestpharm.com';
		$subject = 'Nowe zgłoszenie';
		$message = "Email: $email\n Wiek: $age\n Problem z cerą: $skinProblem\n Czy pali: $smoking\n Solarium: $solarium\n Opalanie: $suntan\n Ciąża: $pregnancy\n Kolagen: $collagen\n Zdjęcie: $file_link";
		$headers = "From: $email";

		// Send email
		if(mail($to, $subject, $message, $headers)){
			echo "Formularz został pomyślnie wysłany.";
			header('Location: '.$_SERVER['REQUEST_URI']); // add this line
			exit; // and this line
		} else {
			echo "Nie udało się wysłać formularza.";
		}
	}
	?>


	<div class="container">
	<form action="" method="post" enctype="multipart/form-data">
		<label for="email">Twój adres e-mail</label><br>
		<input type="email" id="email" name="email" required><br>

		<label for="age">Podaj swój wiek</label><br>
		<input type="text" id="age" name="age" required><br>

		<label for="skinProblem">Czy występuje u Ciebie problem z cerą, jeśli tak to jaki?</label><br>
		<textarea id="skinProblem" name="skinProblem" required></textarea><br>

		<label for="smoking">Czy palisz papierosy? TAK/NIE</label><br>
		<textarea id="smoking" name="smoking" required></textarea><br>

		<label for="solarium">Czy aktywnie korzystasz z solarium, bądź będziesz korzystać w najbliższych 2 miesiącach?</label><br>
		<textarea id="solarium" name="solarium" required></textarea><br>

		<label for="suntan">Czy się opalasz, bądź będziesz się opalać w najbliższych 2 miesiącach?</label><br>
		<textarea id="suntan" name="suntan" required></textarea><br>

		<label for="pregnancy">Czy jesteś w ciąży bądź planujesz w ciągu najbliższych 2 miesięcy ciążę?</label><br>
		<textarea id="pregnancy" name="pregnancy" required></textarea><br>

		<label for="collagen">Czy w ciągu ostatniego roku stosowałaś kolagen MyBestPharm lub jakiejkolwiek innej marki?</label><br>
		<textarea id="collagen" name="collagen" required></textarea><br>

		<label for="file">Załącz zdjęcia twarzy/skóry</label><br>
		<input type="file" id="file" name="file" required><br>

		<input type="submit" value="WYŚLIJ">
	</form>
	</div>
	
	</section>

nord vpnnord vpn
Ad