query("SHOW COLUMNS FROM contact_messages LIKE 'attachments'"); if (!$stmt->fetch(PDO::FETCH_ASSOC)) { try { $pdo->exec("ALTER TABLE contact_messages ADD attachments TEXT NULL AFTER consent_marketing"); } catch (PDOException $e) { if (strpos($e->getMessage(), 'Duplicate column') === false && strpos($e->getMessage(), '1060') === false) throw $e; } } $checked = true; } function contactAttachmentSanitizeName($name) { $convertedName = @iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $name); if ($convertedName !== false) $name = $convertedName; $name = preg_replace('/[^A-Za-z0-9_-]+/', '-', $name); $name = trim($name, '-'); return $name ? strtolower($name) : 'plik'; } function saveContactAttachments($fieldName = 'files') { $result = [ 'success' => true, 'error' => '', 'files_to_send' => [], 'links' => [] ]; if (empty($_FILES[$fieldName]) || empty($_FILES[$fieldName]['name'])) return $result; $uploaded = $_FILES[$fieldName]; $names = is_array($uploaded['name']) ? $uploaded['name'] : [$uploaded['name']]; $tmpNames = is_array($uploaded['tmp_name']) ? $uploaded['tmp_name'] : [$uploaded['tmp_name']]; $sizes = is_array($uploaded['size']) ? $uploaded['size'] : [$uploaded['size']]; $errors = is_array($uploaded['error']) ? $uploaded['error'] : [$uploaded['error']]; $allowedExtensions = contactAttachmentAllowedExtensions(); $maxSize = contactAttachmentMaxSize(); $relativeDir = 'uploads/contact-attachments/' . date('Y') . '/' . date('m'); $targetDir = dirname(__DIR__) . '/' . $relativeDir; if (!is_dir($targetDir) && !mkdir($targetDir, 0755, true)) { $result['success'] = false; $result['error'] = 'upload_dir'; return $result; } for ($i = 0; $i < count($names); $i++) { if (empty($names[$i]) || $errors[$i] == UPLOAD_ERR_NO_FILE) continue; if ($errors[$i] != UPLOAD_ERR_OK) { $result['success'] = false; $result['error'] = 'upload_error'; return $result; } if ((int)$sizes[$i] > $maxSize) { $result['success'] = false; $result['error'] = 'file_size'; return $result; } $extension = strtolower(pathinfo($names[$i], PATHINFO_EXTENSION)); if (!in_array($extension, $allowedExtensions)) { $result['success'] = false; $result['error'] = 'file_type'; return $result; } if (!is_uploaded_file($tmpNames[$i])) { $result['success'] = false; $result['error'] = 'upload_source'; return $result; } $baseName = contactAttachmentSanitizeName(pathinfo($names[$i], PATHINFO_FILENAME)); $fileName = $baseName . '-' . date('YmdHis') . '-' . bin2hex(random_bytes(4)) . '.' . $extension; $targetPath = $targetDir . '/' . $fileName; if (!move_uploaded_file($tmpNames[$i], $targetPath)) { $result['success'] = false; $result['error'] = 'move_failed'; return $result; } $result['files_to_send'][] = $targetPath; $result['links'][] = '/' . $relativeDir . '/' . $fileName; } return $result; } function contactAttachmentFailureMessage() { return 'Zalacznik ma niedozwolony typ pliku albo przekracza limit 50 MB.'; } function saveContactData( $name = '', $email = '', $phone = '', $message = '', $zip = '', $title = '', $company = '', $invoiceNumber = '', $address = '', $formId = '', $voivodeship = '', $clientType = '', $consentOffer = 0, $consentMarketing = 0, $attachments = [] ) { // Konfiguracja bazy danych $dbHost = 'mysql8'; $dbName = '18227288_formularz'; $dbUser = '18227288_formularz'; $dbPass = '_xTmyGrYnzsfdsf5'; try { $pdo = new PDO("mysql:host=$dbHost;dbname=$dbName;charset=utf8mb4", $dbUser, $dbPass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); ensureContactMessagesAttachmentsColumn($pdo); // Przygotowanie danych $data = [ 'form_id' => str_replace(['\'', '"'], '', $formId), 'name' => str_replace(['\'', '"'], '', $name), 'email' => str_replace(['\'', '"'], '', $email), 'phone' => str_replace(['\'', '"'], '', $phone), 'message' => str_replace(["\n", "\r\n", "\r"], ' ', str_replace(['\'', '"'], '', $message)), 'zip_code' => str_replace(['\'', '"'], '', $zip), 'topic' => str_replace(['\'', '"'], '', $title), 'company' => str_replace(['\'', '"'], '', $company), 'invoice_number' => str_replace(['\'', '"'], '', $invoiceNumber), 'address' => str_replace(['\'', '"'], '', $address), // Nowe pola 'voivodeship' => str_replace(['\'', '"'], '', $voivodeship), 'client_type' => str_replace(['\'', '"'], '', $clientType), 'consent_offer' => (int)$consentOffer, 'consent_marketing' => (int)$consentMarketing, 'attachments' => !empty($attachments) ? json_encode(array_values($attachments), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : null, 'created_at' => date('Y-m-d H:i:s') ]; // Zaktualizowane zapytanie SQL $sql = "INSERT INTO contact_messages (form_id, name, email, phone, message, zip_code, topic, company, invoice_number, address, voivodeship, client_type, consent_offer, consent_marketing, attachments, created_at) VALUES (:form_id, :name, :email, :phone, :message, :zip_code, :topic, :company, :invoice_number, :address, :voivodeship, :client_type, :consent_offer, :consent_marketing, :attachments, :created_at)"; $stmt = $pdo->prepare($sql); $stmt->execute($data); } catch (PDOException $e) { error_log("Błąd zapisu do bazy danych: " . $e->getMessage()); } } if ( \S::get('action') == 'send-contact' and \S::get('token') == \S::get_session('send-contact-token') and !\S::get('website') ) { if (isset($_POST['g-recaptcha-response'])) { $captcha = $_POST['g-recaptcha-response']; } if (!$captcha) { \S::alert("Weryfikacja reCaptcha nie powiodła się. Proszę spróbować ponownie."); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $secretKey = "6LfaovglAAAAAAz84QLdbONodP1yJUpSOVTnFMt4"; $ip = $_SERVER['REMOTE_ADDR']; // post request to server $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha); $response = file_get_contents($url); $responseKeys = json_decode($response, true); // should return JSON with success as true if ($responseKeys["success"]) { if ( \S::get('inputTitle') and \S::get('inputName') and \S::get('inputEmail') and \S::get('message') and strposa(\S::get('inputTitle'), $spam_words) === false and strposa(\S::get('inputName'), $spam_words) === false and strposa(\S::get('inputEmail'), $spam_words) === false and \S::get('message') ) { $text = '

Temat: ' . \S::get('inputTitle') . '

'; $text .= '

Imię i nazwisko: ' . \S::get('inputName') . '

'; $text .= '

Email: ' . \S::get('inputEmail') . '

'; $text .= '

Wiadomość: ' . nl2br(\S::get('message')) . '

'; $text .= '

Wysłano: ' . date('Y-m-d H:i:s') . '

'; saveContactData( \S::get('inputName'), \S::get('inputEmail'), '', \S::get('message'), '', \S::get('inputTitle'), '', '', '', 'contact' ); if (\S::send_email('marketing@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send)) { // send copy to k.zarzyczny@vidok.com \S::send_email('k.zarzyczny@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('arkuszevidok@gmail.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('zapytania@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::alert(\S::lang('wiadomosc-zostala-wyslana')); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else { \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } } else { \S::alert("Jesteś robotem!"); } header('Location: ' . $_SERVER['REQUEST_URI']); exit; } if ( \S::get('action') == 'send-contact-modal' and \S::get('token') == \S::get_session('modal-token') and !\S::get('website') ) { $captcha = $_POST['g-recaptcha-response'] ?? null; if (!$captcha) { \S::alert("Weryfikacja reCaptcha nie powiodła się. Proszę spróbować ponownie."); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $secretKey = "6LfaovglAAAAAAz84QLdbONodP1yJUpSOVTnFMt4"; $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha); $response = file_get_contents($url); $responseKeys = json_decode($response, true); if (!$responseKeys['success']) { \S::alert("Jesteś robotem!"); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $files_to_send = []; $attachment_links = []; if ( \S::get( 'name' ) and \S::get( 'email' ) and \S::get( 'address' ) and \S::get( 'phone' ) and strposa( \S::get( 'name' ), $spam_words ) === false and strposa( \S::get( 'email' ), $spam_words ) === false and strposa( \S::get( 'address' ), $spam_words ) === false and strposa( \S::get( 'phone' ), $spam_words ) === false and strposa( \S::get( 'information' ), $spam_words ) === false ) { $text = '

Imię: ' . \S::get('name') . '

'; $text .= '

Email: ' . \S::get('email') . '

'; $text .= '

Kod pocztowy: ' . \S::get('address') . '

'; $text .= '

Telefon: ' . \S::get('phone') . '

'; $text .= '

Wiadomość: ' . nl2br(\S::get('information')) . '

'; $text .= '

wymiary swojej stolarki: ' . nl2br(\S::get('wymiaryStolarki')) . '

'; $text .= '

Wysłano: ' . date('Y-m-d H:i:s') . '

'; $zgoda1 = (\S::get('acceptance-323') == 1) ? 1 : 0; $zgoda2 = (\S::get('acceptance-324') == 1) ? 1 : 0; $fullMessage = \S::get('information'); if (\S::get('wymiaryStolarki')) { $fullMessage .= "\n\n--- Wymiary stolarki ---\n" . \S::get('wymiaryStolarki'); } $uploadedFiles = saveContactAttachments(); if (!$uploadedFiles['success']) { \S::alert(contactAttachmentFailureMessage()); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $files_to_send = $uploadedFiles['files_to_send']; $attachment_links = $uploadedFiles['links']; saveContactData( \S::get('name'), \S::get('email'), \S::get('phone'), $fullMessage, \S::get('address'), '', '', '', '', 'modal-contact-form', '', '', $zgoda1, $zgoda2, $attachment_links ); if ( \S::send_email( 'marketing@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send ) ) { // send copy to k.zarzyczny@vidok.com \S::send_email('k.zarzyczny@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('arkuszevidok@gmail.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('zapytania@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::alert(\S::lang('wiadomosc-zostala-wyslana')); header('Location: ' . $_SERVER['REQUEST_URI'] . '?modal_form_sent=1'); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } if (\S::get('action') == 'send-services' and \S::get('token') == \S::get_session('form-token') and !\S::get('website')) { if ( \S::get('inputName') and \S::get('inputEmail') and \S::get('inputContactNumber') and \S::get('inputInvoiceNumber') and \S::get('inputAdres') and \S::get('message') and strposa(\S::get('inputName'), $spam_words) === false and strposa(\S::get('inputEmail'), $spam_words) === false and strposa(\S::get('inputContactNumber'), $spam_words) === false and strposa(\S::get('inputInvoiceNumber'), $spam_words) === false and strposa(\S::get('inputAdres'), $spam_words) === false and strposa(\S::get('message'), $spam_words) === false ) { $text .= '

Nazwa firmy: ' . \S::get('inputCompanyName') . '

'; $text .= '

Imię i nazwisko: ' . \S::get('inputName') . '

'; $text .= '

Numer faktury sprzedażowej: ' . \S::get('inputInvoiceNumber') . '

'; $text .= '

Numer kontaktowy: ' . \S::get('inputContactNumber') . '

'; $text .= '

Email: ' . \S::get('inputEmail') . '

'; $text .= '

Adres zgłoszenia: ' . \S::get('inputAdres') . '

'; $text .= '

Opis zgłoszenia: ' . nl2br(\S::get('message')) . '

'; $text .= '

Wysłano: ' . date('Y-m-d H:i:s') . '

'; $msg = '

Dziękujemy za kontakt z działem Serwisu i Reklamacji VIDOK.

Zgłoszenie ma obecnie status „rozpoczęte” i zostało zarejestrowane w naszej bazie danych. W przeciągu 5 dni roboczych, pracownik działu serwisu skontaktuje się z Państwem w celu informacji o statusie zgłoszenia.

'; saveContactData( \S::get('inputName'), \S::get('inputEmail'), \S::get('inputContactNumber'), \S::get('message'), '', '', \S::get('inputCompanyName'), \S::get('inputInvoiceNumber'), \S::get('inputAdres'), 'services-form', '', '', 1, 1 ); if (\S::send_email('zgloszenia@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send)) { \S::send_email('serwis@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('arkuszevidok@gmail.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('zapytania@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email(\S::get('inputEmail'), 'Wiadomość ze strony vidok.com', $msg,); \S::alert(\S::lang('wiadomosc-zostala-wyslana')); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } if (\S::get('action') == 'send-contact-landing' and \S::get('token') == \S::get_session('landing-token') and !\S::get('website')) { $countfiles = count($_FILES['files']['name']); for ($i = 0; $i < $countfiles; $i++) { $filename = $_FILES['files']['name'][$i]; if ($filename and pathinfo($_FILES['files']['name'][$i], PATHINFO_EXTENSION) != 'php') { move_uploaded_file($_FILES['files']['tmp_name'][$i], 'temp/' . $filename); $files_to_send[] = 'temp/' . $filename; } } if ( \S::get('name') and \S::get('email') and \S::get('address') and \S::get('phone') and \S::get('information') and strposa(\S::get('name'), $spam_words) === false and strposa(\S::get('email'), $spam_words) === false and strposa(\S::get('address'), $spam_words) === false and strposa(\S::get('phone'), $spam_words) === false and strposa(\S::get('information'), $spam_words) === false ) { $text = '

Imię: ' . \S::get('name') . '

'; $text .= '

Email: ' . \S::get('email') . '

'; $text .= '

Kod pocztowy: ' . \S::get('address') . '

'; $text .= '

Telefon: ' . \S::get('phone') . '

'; $text .= '

Wiadomość: ' . nl2br(\S::get('information')) . '

'; $text .= '

Wysłano: ' . date('Y-m-d H:i:s') . '

'; saveContactData( \S::get('name'), \S::get('email'), \S::get('phone'), \S::get('information'), \S::get('address'), '', '', '', '', 'landing-form', '', '', 1, 1 ); if (\S::send_email('marketing@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send)) { // send copy to k.zarzyczny@vidok.com \S::send_email('k.zarzyczny@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('arkuszevidok@gmail.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('zapytania@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::alert(\S::lang('wiadomosc-zostala-wyslana')); } else { \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); \S::set_session('landing-sended', true); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } if (\S::get('action') == 'send-contact-form-new' and \S::get('token') == \S::get_session('contact-form-token') and !\S::get('website')) { if (isset($_POST['g-recaptcha-response'])) { $captcha = $_POST['g-recaptcha-response']; } if (!$captcha) { \S::alert("Weryfikacja reCaptcha nie powiodła się. Proszę spróbować ponownie."); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $secretKey = "6LfaovglAAAAAAz84QLdbONodP1yJUpSOVTnFMt4"; $ip = $_SERVER['REMOTE_ADDR']; // post request to server $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha); $response = file_get_contents($url); $responseKeys = json_decode($response, true); // should return JSON with success as true if ($responseKeys["success"]) { $files_to_send = []; $attachment_links = []; if ( \S::get('name') and \S::get('email') and \S::get('postal_code') and \S::get('phone') and \S::get('voivodeship') and \S::get('client') and strposa(\S::get('name'), $spam_words) === false and strposa(\S::get('email'), $spam_words) === false and strposa(\S::get('postal_code'), $spam_words) === false and strposa(\S::get('phone'), $spam_words) === false and strposa(\S::get('message'), $spam_words) === false ) { $text = '

Imię: ' . \S::get('name') . '

'; $text .= '

Email: ' . \S::get('email') . '

'; $text .= '

Kod pocztowy: ' . \S::get('postal_code') . '

'; $text .= '

Województwo: ' . \S::get('voivodeship') . '

'; $text .= '

Klient: ' . \S::get('client') . '

'; $text .= '

Telefon: ' . \S::get('phone') . '

'; $text .= '

Wiadomość: ' . nl2br(\S::get('message')) . '

'; $text .= '

Wysłano: ' . date('Y-m-d H:i:s') . '

'; $zgoda1 = (\S::get('zgoda_1') == 'on' || \S::get('zgoda_1') == 1) ? 1 : 0; $zgoda2 = (\S::get('zgoda_2') == 'on' || \S::get('zgoda_2') == 1) ? 1 : 0; $uploadedFiles = saveContactAttachments(); if (!$uploadedFiles['success']) { \S::alert(contactAttachmentFailureMessage()); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $files_to_send = $uploadedFiles['files_to_send']; $attachment_links = $uploadedFiles['links']; saveContactData( \S::get('name'), \S::get('email'), \S::get('phone'), \S::get('message'), \S::get('postal_code'), '', '', '', '', 'contact-form-new', \S::get('voivodeship'), \S::get('client'), $zgoda1, $zgoda2, $attachment_links ); if (\S::send_email('marketing@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send)) { // send copy to k.zarzyczny@vidok.com \S::send_email('k.zarzyczny@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('arkuszevidok@gmail.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('zapytania@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::alert(\S::lang('wiadomosc-zostala-wyslana')); header('Location: ' . $_SERVER['REQUEST_URI'] . '?form_sent=1'); exit; } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else { \S::alert("Jesteś robotem!"); } header('Location: ' . $_SERVER['REQUEST_URI']); exit; } if (\S::get('action') == 'send-partner-form-new' and \S::get('token') == \S::get_session('partner-form-token') and !\S::get('website')) { if (isset($_POST['g-recaptcha-response'])) { $captcha = $_POST['g-recaptcha-response']; } if (!$captcha) { \S::alert("Weryfikacja reCaptcha nie powiodła się. Proszę spróbować ponownie."); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $secretKey = "6LfaovglAAAAAAz84QLdbONodP1yJUpSOVTnFMt4"; $ip = $_SERVER['REMOTE_ADDR']; // post request to server $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha); $response = file_get_contents($url); $responseKeys = json_decode($response, true); // should return JSON with success as true if ( $responseKeys["success"] ) { if ( strposa(\S::get('company'), $spam_words) === false and \S::get('company_address') and \S::get('phone') and \S::get('email') and strposa(\S::get('name'), $spam_words) === false and strposa(\S::get('surname'), $spam_words) === false ) { $aggrement1 = \S::get('aggrement1') === 'on' ? 'Tak' : 'Nie'; $aggrement2 = \S::get('aggrement2') === 'on' ? 'Tak' : 'Nie'; $text = '

Rodzaj Partnera biznesowego: ' . \S::get('partner-type') . '

'; $text .= '

Nazwa Firmy: ' . \S::get('company') . '

'; $text .= '

Adres firmy: ' . \S::get('company_address') . '

'; $text .= '

Telefon: ' . \S::get('phone') . '

'; $text .= '

Adres e-mail: ' . \S::get('email') . '

'; $text .= '

Imię: ' . \S::get('name') . '

'; $text .= '

Nazwisko: ' . \S::get('surname') . '

'; $text .= '

Interesują mnie: ' . \S::get('interesting-me') . '

'; $text .= '

Wyrażam zgodę na przetwarzanie moich danych osobowych podanych przeze mnie powyżej w celu przygotowania stosownej oferty: ' . $aggrement1 . '

'; $text .= '

Wyrażam zgodę na przetwarzanie moich danych osobowych podanych przeze mnie powyżej w celu otrzymywania materiałów reklamowych: ' . $aggrement2 . '

'; $text .= '

Wysłano: ' . date('Y-m-d H:i:s') . '

'; $fullName = \S::get('name') . ' ' . \S::get('surname'); $zgoda1 = (\S::get('aggrement1') == 'on') ? 1 : 0; $zgoda2 = (\S::get('aggrement2') == 'on') ? 1 : 0; $messageContent = 'Interesują mnie: ' . \S::get('interesting-me'); saveContactData( $fullName, \S::get('email'), \S::get('phone'), $messageContent, '', \S::get('interesting-me'), \S::get('company'), '', \S::get('company_address'), 'partner-form-new', '', \S::get('partner-type'), $zgoda1, $zgoda2 ); if (\S::send_email('marketing@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send)) { // send copy to k.zarzyczny@vidok.com \S::send_email('k.zarzyczny@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('arkuszevidok@gmail.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('zapytania@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::alert(\S::lang('wiadomosc-zostala-wyslana')); header('Location: ' . $_SERVER['REQUEST_URI'] . '?form_sent=1'); exit; } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else { \S::alert("Jesteś robotem!"); } header('Location: ' . $_SERVER['REQUEST_URI']); exit; } if (\S::get('action') == 'send-contact-form-new-2' and \S::get('token') == \S::get_session('contact-form-token') and !\S::get('website')) { if (isset($_POST['g-recaptcha-response'])) { $captcha = $_POST['g-recaptcha-response']; } if (!$captcha) { \S::alert("Weryfikacja reCaptcha nie powiodła się. Proszę spróbować ponownie."); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $secretKey = "6LfaovglAAAAAAz84QLdbONodP1yJUpSOVTnFMt4"; $ip = $_SERVER['REMOTE_ADDR']; // post request to server $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha); $response = file_get_contents($url); $responseKeys = json_decode($response, true); // should return JSON with success as true if ($responseKeys["success"]) { $files_to_send = []; $attachment_links = []; if ( \S::get('name') and \S::get('email') and \S::get('postal_code') and \S::get('phone') and \S::get('voivodeship') and \S::get('client') and strposa(\S::get('name'), $spam_words) === false and strposa(\S::get('email'), $spam_words) === false and strposa(\S::get('postal_code'), $spam_words) === false and strposa(\S::get('phone'), $spam_words) === false and strposa(\S::get('message'), $spam_words) === false ) { $text = '

Klient: ' . \S::get('client') . '

'; $text .= '

Imię: ' . \S::get('name') . '

'; $text .= '

Nazwisko: ' . \S::get('surname') . '

'; $text .= '

Telefon: ' . \S::get('phone') . '

'; $text .= '

Email: ' . \S::get('email') . '

'; $text .= '

Województwo: ' . \S::get('voivodeship') . '

'; $text .= '

Kod pocztowy: ' . \S::get('postal_code') . '

'; $text .= '

Wiadomość: ' . nl2br(\S::get('message')) . '

'; $text .= '

Wysłano: ' . date('Y-m-d H:i:s') . '

'; $zgoda1 = (\S::get('zgoda_1') == 'on' || \S::get('zgoda_1') == 1) ? 1 : 0; $zgoda2 = (\S::get('zgoda_2') == 'on' || \S::get('zgoda_2') == 1) ? 1 : 0; $uploadedFiles = saveContactAttachments(); if (!$uploadedFiles['success']) { \S::alert(contactAttachmentFailureMessage()); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $files_to_send = $uploadedFiles['files_to_send']; $attachment_links = $uploadedFiles['links']; saveContactData( \S::get('name'), \S::get('email'), \S::get('phone'), \S::get('message'), \S::get('postal_code'), '', '', '', '', 'contact-form-new', \S::get('voivodeship'), \S::get('client'), $zgoda1, $zgoda2, $attachment_links ); if (\S::send_email('marketing@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send)) { // send copy to k.zarzyczny@vidok.com \S::send_email('k.zarzyczny@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('arkuszevidok@gmail.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('zapytania@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::alert(\S::lang('wiadomosc-zostala-wyslana')); header('Location: ' . $_SERVER['REQUEST_URI'] . '?form_sent=1'); exit; } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else { \S::alert("Jesteś robotem!"); } header('Location: ' . $_SERVER['REQUEST_URI']); exit; } if (\S::get('action') == 'send-contact-form-new-b2b' and \S::get('token') == \S::get_session('contact-form-token') and !\S::get('website')) { if (isset($_POST['g-recaptcha-response'])) { $captcha = $_POST['g-recaptcha-response']; } if (!$captcha) { \S::alert("Weryfikacja reCaptcha nie powiodła się. Proszę spróbować ponownie."); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $secretKey = "6LfaovglAAAAAAz84QLdbONodP1yJUpSOVTnFMt4"; $ip = $_SERVER['REMOTE_ADDR']; // post request to server $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha); $response = file_get_contents($url); $responseKeys = json_decode($response, true); // should return JSON with success as true if ($responseKeys["success"]) { if ( \S::get('name') and \S::get('email') and \S::get('company') and \S::get('phone') and \S::get('client') and strposa(\S::get('name'), $spam_words) === false and strposa(\S::get('email'), $spam_words) === false and strposa(\S::get('company'), $spam_words) === false and strposa(\S::get('phone'), $spam_words) === false and strposa(\S::get('message'), $spam_words) === false ) { $text = '

Klient: ' . \S::get('client') . '

'; $text .= '

Rodzaj Partnera: ' . \S::get('partner-type') . '

'; $text .= '

Nazwa Firmy: ' . \S::get('company') . '

'; $text .= '

Adres firmy: ' . \S::get('address') . '

'; $text .= '

Imię: ' . \S::get('name') . '

'; $text .= '

Nazwisko: ' . \S::get('surname') . '

'; $text .= '

Telefon: ' . \S::get('phone') . '

'; $text .= '

Email: ' . \S::get('email') . '

'; $text .= '

Wiadomość: ' . nl2br(\S::get('message')) . '

'; $text .= '

Wysłano: ' . date('Y-m-d H:i:s') . '

'; $zgoda1 = (\S::get('zgoda_1') == 'on' || \S::get('zgoda_1') == 1) ? 1 : 0; $zgoda2 = (\S::get('zgoda_2') == 'on' || \S::get('zgoda_2') == 1) ? 1 : 0; saveContactData( \S::get('name'), \S::get('email'), \S::get('phone'), \S::get('message'), '', \S::get('company'), \S::get('address'), \S::get('partner-type'), '', 'contact-form-new-b2b', '', \S::get('client'), $zgoda1, $zgoda2 ); if (\S::send_email('marketing@vidok.com', 'Wiadomość ze strony vidok.com (B2B)', $text, \S::get('email'))) { // send copy to k.zarzyczny@vidok.com \S::send_email('k.zarzyczny@vidok.com', 'Wiadomość ze strony vidok.com (B2B)', $text, \S::get('email')); \S::send_email('arkuszevidok@gmail.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email')); \S::send_email('zapytania@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email')); \S::alert(\S::lang('wiadomosc-zostala-wyslana')); header('Location: ' . $_SERVER['REQUEST_URI'] . '?form_sent=1'); exit; } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else { \S::alert("Jesteś robotem!"); } header('Location: ' . $_SERVER['REQUEST_URI']); exit; } if (\S::get('action') == 'send-contact-form-new-deweloper' and \S::get('token') == \S::get_session('contact-form-token') and !\S::get('website')) { if (isset($_POST['g-recaptcha-response'])) { $captcha = $_POST['g-recaptcha-response']; } if (!$captcha) { \S::alert("Weryfikacja reCaptcha nie powiodła się. Proszę spróbować ponownie."); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $secretKey = "6LfaovglAAAAAAz84QLdbONodP1yJUpSOVTnFMt4"; $ip = $_SERVER['REMOTE_ADDR']; // post request to server $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha); $response = file_get_contents($url); $responseKeys = json_decode($response, true); // should return JSON with success as true if ($responseKeys["success"]) { $files_to_send = []; $attachment_links = []; if ( \S::get('name') and \S::get('email') and \S::get('postal_code') and \S::get('phone') and \S::get('voivodeship') and \S::get('client') and strposa(\S::get('name'), $spam_words) === false and strposa(\S::get('email'), $spam_words) === false and strposa(\S::get('postal_code'), $spam_words) === false and strposa(\S::get('phone'), $spam_words) === false and strposa(\S::get('message'), $spam_words) === false ) { $text = '

Klient: ' . \S::get('client') . '

'; $text .= '

Imię: ' . \S::get('name') . '

'; $text .= '

Nazwisko: ' . \S::get('surname') . '

'; $text .= '

Nazwa firmy: ' . \S::get('company') . '

'; $text .= '

Rodzaj inwestycji: ' . \S::get('investment') . '

'; $text .= '

Telefon: ' . \S::get('phone') . '

'; $text .= '

Email: ' . \S::get('email') . '

'; $text .= '

Województwo: ' . \S::get('voivodeship') . '

'; $text .= '

Kod pocztowy: ' . \S::get('postal_code') . '

'; $text .= '

Wiadomość: ' . nl2br(\S::get('message')) . '

'; $text .= '

Wysłano: ' . date('Y-m-d H:i:s') . '

'; $zgoda1 = (\S::get('zgoda_1') == 'on' || \S::get('zgoda_1') == 1) ? 1 : 0; $zgoda2 = (\S::get('zgoda_2') == 'on' || \S::get('zgoda_2') == 1) ? 1 : 0; $uploadedFiles = saveContactAttachments(); if (!$uploadedFiles['success']) { \S::alert(contactAttachmentFailureMessage()); header('Location: ' . $_SERVER['REQUEST_URI']); exit; } $files_to_send = $uploadedFiles['files_to_send']; $attachment_links = $uploadedFiles['links']; saveContactData( \S::get('name'), \S::get('email'), \S::get('phone'), \S::get('message'), \S::get('postal_code'), '', '', '', '', 'contact-form-new', \S::get('voivodeship'), \S::get('client'), $zgoda1, $zgoda2, $attachment_links ); if (\S::send_email('marketing@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send)) { // send copy to k.zarzyczny@vidok.com \S::send_email('k.zarzyczny@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('arkuszevidok@gmail.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::send_email('zapytania@vidok.com', 'Wiadomość ze strony vidok.com', $text, \S::get('email'), $files_to_send); \S::alert(\S::lang('wiadomosc-zostala-wyslana')); header('Location: ' . $_SERVER['REQUEST_URI'] . '?form_sent=1'); exit; } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else \S::alert(\S::lang('wiadomosc-niezostala-wyslana')); } else { \S::alert("Jesteś robotem!"); } header('Location: ' . $_SERVER['REQUEST_URI']); exit; }