Files
de.vidok.com/plugins/special-actions-middle.php
2024-11-17 19:39:31 +01:00

103 lines
4.2 KiB
PHP

<?
$spam_words = [ 'go.tazalus.com', 'porn', 'dating', 'hierbalimon.es', 'bodyandsoul', 'promo', 'puertobelenn', 'faiterde.tk', 'tygyguip', 'maritim-touristik', 'toolbarqueries', 'allnews.elk.pl', 'fuck', 'delicatedate.net', 'allcnews.xyz', 'allcryptonnews', 'hinebixi.com', 'obermatsa', 'hilkom-digital.de', 'monkeydigital.co', 'CrytoPRove', 'no-site.com', 'strictlydigital', 'youtu.be', 'wilhetiperbe', 'blogspot.com', 'suck', 'dana@parkcitynursery.com', 'suqomuaq.com', 'semrush', 'diryjyaz.com', 'obermatsa.com', 'hinebixi.com', 'rarealnojahr.gq', 'osii@eff.effect.edu.pl', 'Injek@gmail.com', 'WhatsApp-Nummer', 'osii@eff.effect.edu.pl', 'smtpfox-upyca@marflex.s1.clickrlabs.com', 'osii@eff.effect.edu.pl', 'Jarosz-Opolka', 'peter.behrmann@gmx.de' ];
function strposa( $haystack, $needles = array(), $offset = 0 ) {
$chr = array();
foreach ( $needles as $needle ) {
$res = strpos($haystack, $needle, $offset);
if ($res !== false) $chr[$needle] = $res;
}
if ( empty($chr) )
return false;
return min($chr);
}
function saveContactData($email, $phone, $companyName, $typeCooperation, $message) {
$contactHistoryFile = $_SERVER['DOCUMENT_ROOT'] . '/autoinstalator/wordpress/forms.csv';
$contactData = array(
'Email' => $email,
'Phone' => $phone,
'Company' => $companyName,
'Cooperation' => $typeCooperation,
'Message' => $message,
'Timestamp' => date('Y-m-d H:i:s', time())
);
if (!file_exists($contactHistoryFile)) {
$header = array_keys($contactData);
$history = array($header);
} else {
$history = array_map('str_getcsv', file($contactHistoryFile));
}
$history[] = $contactData;
$csvContent = fopen($contactHistoryFile, 'w');
foreach ($history as $row) {
fputcsv($csvContent, $row);
}
fclose($csvContent);
}
if ( \S::get( 'action' ) == 'send_contact_form' and \S::get( 'token' ) == \S::get_session( 'form-token' ) and !\S::get( 'website' ) )
{
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
\S::alert( "reCaptcha-Überprüfung fehlgeschlagen. Bitte versuche es erneut." );
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( 'email' )
and
strposa( $_POST['type_cooperation'], $spam_words ) === false
and
strposa( $_POST['company_name'], $spam_words ) === false
and
strposa( $_POST['email'], $spam_words ) === false
and
strposa( $_POST['phone'], $spam_words ) === false
and
strposa( $_POST['your_message'], $spam_words ) === false )
{
$text = '<p><b>Rodzaj współpracy:</b> ' . \S::get( 'type_cooperation' ) . '</p>';
$text .= '<p><b>Firma:</b> ' . \S::get( 'company_name' ) . '</p>';
$text .= '<p><b>Email:</b> ' . \S::get( 'email' ) . '</p>';
$text .= '<p><b>Telefon:</b> ' . \S::get( 'phone' ) . '</p>';
$text .= '<p><b>Wiadomość:</b> ' . nl2br(\S::get('your_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>';
// anfrage@vidok.com
// roman.pyrih@project-pro.pl
if ( \S::send_email( 'anfrage@vidok.com', 'Wiadomość ze strony de.vidok.com', $text, \S::get( 'inputEmail' ) ) ) {
saveContactData(
\S::get( 'email' ),
\S::get( 'phone' ),
\S::get( 'company_name' ),
\S::get( 'type_cooperation' ),
nl2br(\S::get('your_message'))
);
\S::alert( 'Das Formular wurde gesendet.' );
} else {
\S::alert( \S::lang( 'wiadomosc-niezostala-wyslana' ) );
}
} else {
\S::alert( \S::lang( 'wiadomosc-niezostala-wyslana' ) );
}
} else {
\S::alert( "Du bist Boot! 4" );
}
header( 'Location: ' . $_SERVER['REQUEST_URI'] );
exit;
}