$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', 'Cryptaxbot', 'arryspasp@gmail.com', 'stomathartov@gmail.com', 'nellyspasp@gmail.com' ]; 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($name, $email, $address, $zip, $phone, $cooperation, $message) { $contactHistoryFile = $_SERVER['DOCUMENT_ROOT'] . '/vidok_it/forms.csv'; $contactData = array( 'Name' => str_replace( [ '\'', '"' ], '', $name ), 'Email' => str_replace( [ '\'', '"' ], '', $email ), 'Address' => str_replace( [ '\'', '"' ], '', $address ), 'Zip_code' => str_replace( [ '\'', '"' ], '', $zip ), 'Phone' => str_replace( [ '\'', '"' ], '', $phone ), 'Cooperation' => str_replace( [ '\'', '"' ], '', $cooperation ), 'Message' => str_replace( [ "\n", "\r\n", "\r" ], ' ', str_replace( [ '\'', '"' ], '', $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); // // call webhook http://projectpro.dynu.net:5678/webhook-test/744ec5ad-9e7d-4a97-8391-d172c6c02eff // $webhookUrl = 'http://projectpro.dynu.net:5678/webhook/744ec5ad-9e7d-4a97-8391-d172c6c02eff'; // $data = json_encode( $contactData ); // $ch = curl_init( $webhookUrl ); // curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); // curl_setopt( $ch, CURLOPT_POST, true ); // curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' ) ); // curl_setopt( $ch, CURLOPT_POSTFIELDS, $data ); // curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 3 ); // curl_setopt( $ch, CURLOPT_TIMEOUT, 5 ); // $response = curl_exec( $ch); // curl_close( $ch ); } if ( \S::get( 'action' ) == 'footer_contact_mail_send' 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( "Verifica reCaptcha fallita. Per favore riprova." ); header( 'Location: ' . $_SERVER['REQUEST_URI'], true, 303 ); 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( 'indirizzo' ) and \S::get( 'phone' ) and \S::get( 'altre-informazioni' ) and strpos( \S::get( 'altre-informazioni' ), 'http://' ) === false and strpos( \S::get( 'altre-informazioni' ), 'https://' ) === false and strposa( $_POST['address'], $spam_words ) === false and strposa( $_POST['information'], $spam_words ) === false and strposa( $_POST['name'], $spam_words ) === false ) { $text = '
Imię: ' . \S::get( 'name' ) . '
'; $text .= 'Email: ' . \S::get( 'email' ) . '
'; $text .= 'Adres: ' . \S::get( 'indirizzo' ) . '
'; $text .= 'Kod pocztowy: ' . \S::get( 'zip_code' ) . '
'; $text .= 'Telefon: ' . \S::get( 'phone' ) . '
'; $text .= 'Rodzaj współpracy: ' . \S::get( 'kind_of_cooperation' ) . '
'; $text .= 'Wiadomość: ' . nl2br( \S::get( 'altre-informazioni' ) ) . '
'; $text .= 'Wysłano: ' . date( 'Y-m-d H:i:s' ) . '
'; saveContactData( \S::get('name'), \S::get('email'), \S::get('indirizzo'), \S::get('zip_code'), \S::get('phone'), \S::get('kind_of_cooperation'), \S::get('altre-informazioni') ); if ( \S::send_email( 'm.kawa@vidok.com', 'Wiadomość ze strony it.vidok.com', $text, \S::get( 'email' ) ) ) { \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( "Sei un robot!" ); } header( 'Location: https://it.vidok.com/#contatto', true, 303 ); exit; } if ( \S::get( 'action' ) == 'send-contact-modal' and \S::get( 'token' ) == \S::get_session( 'modal-token' ) and !\S::get( 'website' ) and strposa( $_POST['address'], $spam_words ) === false and strposa( $_POST['information'], $spam_words ) === false and strposa( $_POST['name'], $spam_words ) === false ) { if(isset($_POST['g-recaptcha-response'])){ $captcha=$_POST['g-recaptcha-response']; } if(!$captcha){ \S::alert( "Verifica reCaptcha fallita. Per favore riprova." ); header( 'Location: ' . $_SERVER['REQUEST_URI'], true, 303 ); 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 ) { 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 strpos( \S::get( 'information' ), 'http://' ) === false and strpos( \S::get( 'information' ), 'https://' ) === false ) { $text = 'Imię: ' . \S::get( 'name' ) . '
'; $text .= 'Email: ' . \S::get( 'email' ) . '
'; $text .= 'Adres: ' . \S::get( 'address' ) . '
'; $text .= 'Kod pocztowy: ' . \S::get( 'zip_code' ) . '
'; $text .= 'Telefon: ' . \S::get( 'phone' ) . '
'; $text .= 'Rodzaj współpracy: ' . \S::get( 'kind_of_cooperation' ) . '
'; $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('address'), \S::get('zip_code'), \S::get('phone'), \S::get('kind_of_cooperation'), \S::get('information') ); if ( \S::send_email( 'm.kawa@vidok.com', 'Wiadomość ze strony it.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( "Sei un robot!" ); } header( 'Location: https://it.vidok.com/#contatto', true, 303 ); exit; }