From d07f59541e5a4dc853207f2d6b247e75f76c6e99 Mon Sep 17 00:00:00 2001 From: Roman Pyrih Date: Fri, 9 Jan 2026 08:59:31 +0100 Subject: [PATCH] Update "g-recaptcha" key --- buy-by-phone.php | 103 ++++++++++++++++++ .../catalog/_partials/buy-by-phone-popup.tpl | 2 +- 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 buy-by-phone.php diff --git a/buy-by-phone.php b/buy-by-phone.php new file mode 100644 index 00000000..f69186af --- /dev/null +++ b/buy-by-phone.php @@ -0,0 +1,103 @@ + 'sklep@drmaterac.pl', + 'email_host' => 'serwer2140447.home.pl', + 'email_login' => 'sklep@drmaterac.pl', + 'email_password' => '8njIZnAb', + 'email_port' => 465, +); + +$settings_lula = array( + 'email_mail' => 'sklep@lulandia.pl', + 'email_host' => 'serwer2140447.home.pl', + 'email_login' => 'sklep@lulandia.pl', + 'email_password' => 'kM4BU_F_', + 'email_port' => 465, +); +if(isset($_POST['g-recaptcha-response'])) + $captcha=$_POST['g-recaptcha-response']; + +$response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_key."&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true); +if($response['success'] == false) { + echo '

Weryfikacja reCAPTCHA nie powiodła się. Proszę spróbować ponownie.

'; exit; +} else { + if (isset($_POST['buy-by-phone-name'])) { + + if ($_POST['buy-by-phone-mail-from'] == 'Dr Materac') { + $settings = $settings_dr; + } elseif ($_POST['buy-by-phone-mail-from'] == 'Lulandia') { + $settings = $settings_lula; + } else { + $settings = $settings_dr; + } + + $name = $_POST['buy-by-phone-name']; + $phone = $_POST['buy-by-phone-phone']; + $mailFrom = $_POST['buy-by-phone-mail-from']; + $productName = $_POST['buy-by-phone-product-name']; + $productURI = $_POST['buy-by-phone-product-uri']; + + $contact_time = $_POST['contact-time']; + $buy_by_phone_need_advice = $_POST['buy-by-phone-need-advice']; + $product_to_buy = $_POST['product-to-buy']; + $shipping_address = $_POST['shipping-address']; + $phone_for_courier = $_POST['phone-for-courier']; + $email = $_POST['email']; + $comments_to_order = $_POST['comments-to-order']; + + $mail = new PHPMailer(); + + //Server settings + $mail->isSMTP(); + $mail->Host = $settings['email_host']; + $mail->SMTPAuth = true; + $mail->Username = $settings['email_login']; + $mail->Password = $settings['email_password']; + $mail->SMTPSecure = 'ssl'; + $mail->Port = $settings['email_port']; + $mail->CharSet = "UTF-8"; + + //Recipients + $mail->setFrom($settings['email_mail'], $mailFrom); + $mail->addAddress('mci@drmaterac.pl'); + + if (!empty($email)) { + $mail->addAddress($email); + } + + //Content + $mail->isHTML(true); //Set email format to HTML + $mail->Subject = $mailFrom; // email subject headings + $mail->Body = '

Temat: Zamówienie przez telefon

' . + '

Imię: ' . $name . '

' . + '

Telefon: ' . $phone . '

' . + '

Produkt: ' . $productName . '

' . + '

Adres produktu: ' . $productURI . '

' . + '

Preferowana data/godzina kontaktu: ' . $contact_time . '

' . + '

Potrzebuję porady odnośnie doboru produktu: ' . $buy_by_phone_need_advice . '

' . + '

Produkt jaki chcę kupić: ' . $product_to_buy . '

' . + '

Adres do wysyłki: ' . $shipping_address . '

' . + '

Numer telefonu dla kuriera: ' . $phone_for_courier . '

' . + '

E-mail: ' . $email . '

' . + '

Uwagi do zamówienia: ' . $comments_to_order . '

'; + + // Success sent message alert + if ($mail->send()) { + echo '

Formularz został pomyślnie wysłany.

Wkrótce się skontaktujemy

'; + } else { + echo '

Błąd podczas wysyłania wiadomości

'; + } + } +}; \ No newline at end of file diff --git a/themes/leo_lulandia/templates/catalog/_partials/buy-by-phone-popup.tpl b/themes/leo_lulandia/templates/catalog/_partials/buy-by-phone-popup.tpl index d9b562f8..4834ffdd 100644 --- a/themes/leo_lulandia/templates/catalog/_partials/buy-by-phone-popup.tpl +++ b/themes/leo_lulandia/templates/catalog/_partials/buy-by-phone-popup.tpl @@ -70,7 +70,7 @@
-
+