Save
This commit is contained in:
@@ -579,3 +579,79 @@ if (\S::get('action') == 'send-partner-form-new' and \S::get('token') == \S::get
|
||||
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"])
|
||||
{
|
||||
$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('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 = '<p><b>Klient:</b> ' . \S::get('client') . '</p>';
|
||||
$text .= '<p><b>Imię:</b> ' . \S::get('name') . '</p>';
|
||||
$text .= '<p><b>Nazwisko:</b> ' . \S::get('surname') . '</p>';
|
||||
$text .= '<p><b>Telefon:</b> ' . \S::get('phone') . '</p>';
|
||||
$text .= '<p><b>Email:</b> ' . \S::get('email') . '</p>';
|
||||
$text .= '<p><b>Województwo:</b> ' . \S::get('voivodeship') . '</p>';
|
||||
$text .= '<p><b>Kod pocztowy:</b> ' . \S::get('postal_code') . '</p>';
|
||||
$text .= '<p><b>Wiadomość:</b> ' . nl2br(\S::get('message')) . '</p>';
|
||||
$text .= '<p style="font-size: 13px; color: #ccc; margin-top: 50px;"><b>Wysłano:</b> ' . date('Y-m-d H:i:s') . '</p>';
|
||||
|
||||
$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('postal_code'), '', '', '', '', 'contact-form-new', \S::get('voivodeship'), \S::get('client'), $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::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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user