Escape(Tools_Http::Post('name')); $email = $DB->Escape(Tools_Http::Post('email')); $place = $DB->Escape(Tools_Http::Post('place')); //$subject = $DB->Escape(Tools_Http::Post('subject')); $price = $DB->Escape(Tools_Http::Post('price')); $product_name =Tools_Http::Post('product'); $url = 'https://www.google.com/recaptcha/api/siteverify'; $data = array('secret' => '6LdwSwcTAAAAAGrF02Ad4-ZmDOna43wvsrmFb-L6', 'response' => $_POST['g-recaptcha-response'] , 'remoteip'=>$_SERVER['REMOTE_ADDR']); // use key 'http' even if you send the request to https://... $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data), ) ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); $resultArr = json_decode($result); $product_id = $DB->Escape(Tools_Http::Post('product_id',1)); $contacts = new Contacts; $array['product_id'] = $product_id; $array['product_name'] = $product_name; $array['name'] = $name; $array['email'] = $email; $array['text'] = ''; $array['price'] = $price; $array['link'] = $place; $array['type'] = 2; $err = ''; $fields = array(); if (!$name) { $err = $L->Str('Please enter your name!'); $fields[] = 'name'; } if (!$email) { $err = $L->Str('Please enter your email!'); $fields[] = 'email'; } if (!$price) { $err = $L->Str('Please enter your price!'); $fields[] = 'price'; } if(!$resultArr->success) { $err = $L->Str('Bot check failed!'); $fields[] = 'captcha'; } if (!$err) { $msg = "

Redzejat letāk:

\n\n"; $msg .= "Datums: ".date("d.m.Y H:i")."\n"; $msg .= "IP adrese: ".Tools_Http::getIP()."\n"; $msg .= "
\n"; $msg .= "

Lietotāja dati

\n"; $msg .= "Vārds: ".Tools_Text::htmlEscape($name)."\n"; $msg .= "E-pasts: ".Tools_Text::htmlEscape($email)."\n\n"; $msg .= "Prece: ".$product_name."\n"; $msg .= "Cena: ".Tools_Text::htmlEscape($price)."\n"; $msg .= "Vieta: ".Tools_Text::htmlEscape($place)."\n"; $to = 'info@euroled.lv'; $result = Tools_Email::sendMail($to,'Redzejat letāk: '.Tools_Text::htmlEscape($name),$msg); $contacts->insertItem($array); ?>