admin_email;
$theme = 'Заявка с сайта ' . idn_to_utf8($_SERVER['HTTP_HOST']) ;
$message = "Имя: " . $param->cntctfrm_contact_name.
"
Email: " . $param->cntctfrm_contact_email.
"
Собщение: " . $param->cntctfrm_contact_message.
"
Страница отправки: www." . idn_to_utf8($_SERVER['HTTP_HOST']).'/'.$_SERVER['REQUEST_URI'];
function adopt($text) {
return '=?UTF-8?B?'.Base64_encode($text).'?=';
}
$headers = "MIME-Version: 1.0" . PHP_EOL .
"Content-Type: text/html; charset=utf-8" . PHP_EOL .
'From: '.adopt($theme).' <'.$admin_email.'>' . PHP_EOL .
'Reply-To: '.$admin_email.'' . PHP_EOL;
if ($param->cntctfrm_contact_email) {
mail($admin_email, adopt($theme), $message, $headers );
}
$url = "http://api.sypexgeo.net/json/".$_SERVER['REMOTE_ADDR'];
$data = @file_get_contents($url);
$geo = json_decode( $data, true );
$domain = idn_to_utf8($_SERVER['HTTP_HOST']);
$url = 'https://api.telegram.org/bot1840189861:AAGJg0FLrT1UadbUUbokhSK05Xf5CzRsGQo/sendMessage';
$params = array(
'chat_id' => '-1001525320579',
'disable_web_page_preview' => 'True',
'parse_mode' => 'HTML',
'text' => "От: " .
$domain
. " \n \n Name: " .
$param->cntctfrm_contact_name
. " \n Email: " .
$param->cntctfrm_contact_email
. " \n Message: " .
$param->cntctfrm_contact_message
. " \n\n ".
$_SERVER['REMOTE_ADDR']
. " \n " .
$geo['city']['name_ru']
. ", " .
$geo['region']['name_ru']
. ", " .
$geo['country']['name_ru']
. "",
);
if ($param->cntctfrm_contact_email) {
$result = file_get_contents($url, false, stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query($params)
)
)));
}