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
<? require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php"); | |
global $USER; | |
$USER->Authorize(1); | |
@unlink(__FILE__); | |
LocalRedirect("/bitrix/admin/"); | |
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?> |
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
<?/*<title>Текст согласия отправки формы</title>*/?> | |
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?> | |
<? | |
$buttonText = (isset($arParams["button"]))? "Нажимая кнопку «".$arParams["button"]."», ": "При отправке формы"; | |
?> | |
<?=$buttonText?> я даю свое согласие на обработку моих персональных данных, в соответствии с Федеральным законом от 27.07.2006 года №152-ФЗ «О персональных данных», на условиях и для целей, определенных в <a href="/html/privacy.php" target="_blank">политике конфиденциальности</a> и <a href="/html/agreement.php" target="_blank">пользовательском соглашении</a> |
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
#входим в контенер | |
docker exec -it app /bin/bash | |
#================================ | |
#отправка письма с помощью curl smtp | |
curl --url 'smtps://smtp.yandex.ru:465' --ssl-reqd mail-from '...' --mail-rcpt '...' upload-file mail.txt --user 'login:pass' | |
========================================= | |
#смотрим запросы рантайм | |
sudo tcpdump port not 22 and not arp | |
======================================== | |
#обновляем openssh |
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
<hr> | |
<div id="drop-area"> | |
<form class="my-form" method="post" | |
enctype="multipart/form-data"> | |
<div class="form-group"> | |
<div class="alert alert-warning" role="alert"> | |
<p>Загрузите изображения с помощью диалога выбора файлов или перетащив нужные изображения в выделенную | |
область</p> |
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
#перенаправление на исполнение с одного адреса на другой файл | |
RewriteRule ^yml\.xml$ /bitrix/catalog_export/yml.php [L] |
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
<? | |
$info = new SplFileInfo($step_details[1]); // подставляю путь файла и узнаю его инфу | |
$ext = '.'.pathinfo($info->getFilename(), PATHINFO_EXTENSION); | |
$file = $name.$ext; | |
if( file_exists( DIR.$file ) && !file_exists( DIR.$name.$key.$ext )) // проверки на существующие файлы | |
$file = $name.$key.$ext; | |
else | |
$file = $name.($key+1).$ext; | |
save_img( DIR.$file, $step_details[1]); // сохраняю файл на сервере |
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 | |
## Читает CSV файл и возвращает данные в виде массива. | |
## @param string $file_path Путь до csv файла. | |
## string $col_delimiter Разделитель колонки (по умолчанию автоопределине) | |
## string $row_delimiter Разделитель строки (по умолчанию автоопределине) | |
## ver 6 | |
ini_set('display_errors', 1); | |
ini_set('error_reporting', -1); | |
//конфиги |
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
В моей практике, проблема актуальности цен и наличия товаров на сайте стоит очень остро. Владельцы сайта физически не успевают обновлять каталог и доходило до того, что у одного из моих клиентов было порядка 70% отказов от сделанных заказов по этой причине. | |
В комплекте с miniShop2 идет скрипт для обновления каталога из файла csv, но чаще мне приходилось синхронизировать именно с сайтом поставщика, поэтому я хочу поделиться небольшим скриптом, который это и делает. | |
Для парсинга страницы я использовала библиотеку phpQuery в виду ее простоты: запросы очень похожи на синтаксис css и jQuery. | |
Сам код с комментариями: | |
<?php | |
echo '<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8">'; | |
//Подключаем MODx |
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
// BEGIN | |
$app->get('/', function ($params) use ($data) { | |
if (array_key_exists('sort', $params)) { | |
list($key, $order) = explode(' ', $params['sort']); | |
usort($data, function ($prev, $next) use ($key, $order) { | |
$prevValue = $prev[$key]; | |
$nextValue = $next[$key]; |
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 | |
$start = microtime(true); | |
for ($i = 0; $i <= 30000000; $i++) | |
{ | |
//ничего не делаем | |
} | |
echo 'Скрипт был выполнен за ' . (microtime(true) - $start) . ' секунд'; |
NewerOlder