This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = form.serialize(); // подготавливаем данные | |
$.ajax({ // инициализируем ajax запрос | |
type: 'POST', // отправляем в POST формате, можно GET | |
url: 'files/do-email.php', // путь до обработчика, у нас он лежит в той же папке | |
dataType: 'json', // ответ ждем в json формате | |
data: data, // данные для отправки | |
beforeSend: function(data) { // событие до отправки | |
form.find('button[type="submit"]').attr('disabled', 'disabled'); // например, отключим кнопку, чтобы не жали по 100 раз | |
}, | |
success: function(data){ // событие после удачного обращения к серверу и получения ответа |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: Андрей | |
* Date: 01.08.2017 | |
* Time: 15:39 | |
*/ | |
if ((isset($_POST['NAME']) && $_POST['NAME'] != "") && (isset($_POST['PHONE']) && $_POST['PHONE'] != "")) { //Проверка отправилось ли наше поля name и не пустые ли они | |
$to = '[email protected]'; //, [email protected], [email protected], [email protected]'; //Почта получателя, через запятую можно указать сколько угодно адресов | |
function clearing($str) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function line() { | |
echo __LINE__; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generatePassword($length = 8){ | |
$chars = 'abdefhiknrstyzABDEFGHKNQRSTYZ23456789'; | |
$numChars = strlen($chars); | |
$string = ''; | |
for ($i = 0; $i < $length; $i++) { | |
$string .= substr($chars, rand(1, $numChars) - 1, 1); | |
} | |
return $string; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (CModule::IncludeModule("iblock")) | |
{ | |
$arFilter = array( | |
"ACTIVE" => "Y", | |
"GLOBAL_ACTIVE" => "Y", | |
"IBLOCK_ID" => $arParams["IBLOCK_ID"], | |
); | |
if(strlen($arResult["VARIABLES"]["SECTION_CODE"])>0) | |
{ | |
$arFilter["CODE"] = $arResult["VARIABLES"]["SECTION_CODE"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$link = parse_url($youTubeRef, PHP_URL_QUERY); | |
$link = substr($link, 2); | |
$key = "AIzaSyC_pztO0mmCmOwe2FaJjF5vZuM80UGLCO8"; | |
$buf = file_get_contents("https://www.googleapis.com/youtube/v3/videos?part=snippet&id=".$link."&key=".$key); | |
$json = json_decode($buf, 1); | |
$title = $json['items'][0]['snippet']['title']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pluralForm($n, $resultat, $resultata, $resultatov) | |
{ | |
$n = abs($n) % 100; | |
$n1 = $n % 10; | |
if ($n > 10 && $n < 20) return $resultatov; | |
if ($n1 > 1 && $n1 < 5) return $resultata; | |
if ($n1 == 1) return $resultat; | |
return $resultatov; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$MESS["CT_BCSL_ELEMENT_DELETE_CONFIRM"] = "Будет удалена вся информация, связанная с этой записью. Продолжить?"; | |
$strSectionEdit = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "SECTION_EDIT"); | |
$strSectionDelete = CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "SECTION_DELETE"); | |
$arSectionDeleteParams = array("CONFIRM" => GetMessage('CT_BCSL_ELEMENT_DELETE_CONFIRM')); | |
$this->AddEditAction($arSection['ID'], $arSection['EDIT_LINK'], $strSectionEdit); | |
$this->AddDeleteAction($arSection['ID'], $arSection['DELETE_LINK'], $strSectionDelete, $arSectionDeleteParams); | |
$this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_EDIT")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$map_data['yandex_lat'] = $latitude; //значение типа 56.827911201256 | |
$map_data['yandex_lon'] = $longitude; //значение типа 56.827911201256 | |
$map_data['yandex_scale'] = 14; | |
$map_data['PLACEMARKS'][0] = array( | |
"LON" => $longitude, | |
"LAT" => $latitude, | |
"TEXT" => $address //любая текстовая строка | |
); | |
$APPLICATION->IncludeComponent( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php"); | |
$filepath = $_SERVER['DOCUMENT_ROOT'] . "/upload/price.xlsx"; //файл для считывания | |
$beginIndex = 12; //первая строка, с которой нужно начать считывание | |
define("IBLOCK_CATALOG_ID", 4); //ID инфоблока с каталогом | |
define("SUPPLIER_CODE", "OLDIMGROUP"); //код свойства с поставщиком | |
if (!file_exists($filepath)) { | |
print "No input file specified.\n"; |