Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function autoUTF($s)
- {
- if (preg_match('#[\x80-\x{1FF}\x{2000}-\x{3FFF}]#u', $s))
- {
- return $s;
- }
- elseif (preg_match('#[\x7F-\x9F\xBC]#', $s))
- {
- return iconv('WINDOWS-1250', 'UTF-8', $s);
- }
- else
- {
- return iconv('ISO-8859-2', 'UTF-8', $s);
- }
- }
- function cs_mail($to, $predmet, $zprava, $head = "")
- {
- $predmet = "=?utf-8?B?".base64_encode(autoUTF($predmet))."?=";
- $head .= "MIME-Version: 1.0\r\n";
- $head .= "Content-Type: text/plain; charset=\"utf-8\"\r\n";
- $head .= "Content-Transfer-Encoding: base64\r\n";
- $zprava = base64_encode(autoUTF($zprava));
- return mail($to, $predmet, $zprava, $head);
- }
- $mail = "gledy@seznam.cz"; //komu email prijde
- $jmeno = $_GET["Jmeno"];
- $predmet = $_GET["Predmet"];
- $zprava = $_GET["Zprava"];
- $email = $_GET["Email"];
- if ($jmeno!="" and $predmet !="" and $zprava !="" and $email!="")
- {
- if (cs_mail($mail, $predmet, $zprava, 'From:' .$jmeno. '<'.$email.'>'))
- {
- echo "<script>location.href=\"odeslano.php\"</script>";
- }}
- else
- {
- echo "<p>Váši zprávu <strong>nepodařilo odeslat,</strong> pravděpodobně jste nevyplnili všechny povinné údaje, <a href='/kontakt'> <strong>Odeslat znovu</strong></a></p>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement