Update "g-recaptcha" key
This commit is contained in:
103
buy-by-phone.php
Normal file
103
buy-by-phone.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
//required files
|
||||
require 'phpmailer/src/Exception.php';
|
||||
require 'phpmailer/src/PHPMailer.php';
|
||||
require 'phpmailer/src/SMTP.php';
|
||||
|
||||
$recaptcha_key = '6LeJAUUsAAAAAIyCrwFMrsw9yQLPgnCWCOHPcjc8';
|
||||
$settings = array();
|
||||
|
||||
$settings_dr = array(
|
||||
'email_mail' => '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 '<p>Weryfikacja reCAPTCHA nie powiodła się. Proszę spróbować ponownie.</p>'; 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 = '<p>Temat: Zamówienie przez telefon</p>' .
|
||||
'</p>Imię: ' . $name . '</p>' .
|
||||
'</p>Telefon: ' . $phone . '</p>' .
|
||||
'</p>Produkt: ' . $productName . '</p>' .
|
||||
'</p>Adres produktu: ' . $productURI . '</p>' .
|
||||
'</p>Preferowana data/godzina kontaktu: ' . $contact_time . '</p>' .
|
||||
'</p>Potrzebuję porady odnośnie doboru produktu: ' . $buy_by_phone_need_advice . '</p>' .
|
||||
'</p>Produkt jaki chcę kupić: ' . $product_to_buy . '</p>' .
|
||||
'</p>Adres do wysyłki: ' . $shipping_address . '</p>' .
|
||||
'</p>Numer telefonu dla kuriera: ' . $phone_for_courier . '</p>' .
|
||||
'</p>E-mail: ' . $email . '</p>' .
|
||||
'</p>Uwagi do zamówienia: ' . $comments_to_order . '</p>';
|
||||
|
||||
// Success sent message alert
|
||||
if ($mail->send()) {
|
||||
echo '<p>Formularz został pomyślnie wysłany.</p><p>Wkrótce się skontaktujemy</p>';
|
||||
} else {
|
||||
echo '<p>Błąd podczas wysyłania wiadomości</p>';
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -70,7 +70,7 @@
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<div class="g-recaptcha" data-sitekey="6LeEV5YnAAAAAEGp1y2Ci_lkqhQgbJNz67oCk_dU"></div>
|
||||
<div class="g-recaptcha" data-sitekey="6LeJAUUsAAAAAB9l4SYYqmjAS6RwHwoyfUgTJQ5e"></div>
|
||||
<br/>
|
||||
|
||||
<button type="submit" class="form-control-submit lql-form-bt lql-register-bt btn btn-primary"
|
||||
|
||||
Reference in New Issue
Block a user