Skip to content

Instantly share code, notes, and snippets.

View exileed's full-sized avatar
🎵
NP: North Star of Nija (Orbit Culture) (3:25/5:14)

Dmitriy Kuts exileed

🎵
NP: North Star of Nija (Orbit Culture) (3:25/5:14)
View GitHub Profile
<?php
require_once 'database_connection.php';
function authorize_user($groups = NULL) {
// Если не создан cookie-файл, проверять группы не нужно
if ((!isset($_COOKIE['user_id'])) || (!strlen($_COOKIE['user_id']) > 0)) {
header('Location: signin.php?' . 'error_message=Для просмотра этой страницы нужно зарегистрироваться.');
exit;
<?php
$user_id = $_SESSION['user']['id'];
$STH = $pdo->query ( "SELECT * FROM dialog WHERE recive = $user_id OR send = $user_id ORDER by id DESC" );
$STH->setFetchMode ( PDO::FETCH_OBJ );
$row = $STH->fetch ();
$us_log1 = $row->send;
$us_log2 = $row->recive;
if ($us_log2 == $user_id) ($us_log2 = $us_log1);
@exileed
exileed / StaInstall.php
Last active January 11, 2018 01:51
Code Class
<?php
/*
* Название класса не по psr1,psr-2, -> StaInstall
* Сама по себе реализация спорная.
* Тут 2 варианта идти по пути фреймворков (пользователя сами настраивают ) или все делает движок.
* в случае движка. мы должны не создавать новый файл конфигураций. я копировать config.demo.php в config.php, и уже там менять параметры.
* Прст, завтра мы захотим еще что-то там хранить. что будет тогда ?
*/
<?php
class Connect {
private $connection;
public function __construct(){
$this->connect();
}
public function connect(){
@exileed
exileed / index.php
Last active September 19, 2017 00:35
<?php
class Vk {
private $vk;
private $owner;
public function __construct( vk $vk, $user = null, $group = null ) {
$this->vk = $vk;
if ( ! $user && ! $group ) {
@exileed
exileed / SoftDelete.php
Created August 8, 2017 21:36
Soft delete behavior for Yii2 ActiveRecord
<?php
namespace app\traits;
/**
* Soft delete behavior for Yii2 ActiveRecord
*
* @property-read bool $isDeleted
*/
trait SoftDelete
@exileed
exileed / router.php
Last active July 3, 2017 16:58
Notice: Undefined offset: 2 in /var/www/html/lib/router.php on line 44
<?php
##### ##### # # ##### ### ## # ##### ## ##
# # # # # # # # # # # # ## ##
##### # # # # # # # # # # ##
# # # # # # # # # # # # # # #
# # ##### ### # ### # ## ##### # #
# #
/** Router class by Mr CaT ) ) ) #########
@exileed
exileed / git-deployment.md
Created June 6, 2017 15:20 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

<?php
namespace app\controllers;
use app\models\Login;
use app\models\Otchet;
use app\models\Result;
use app\models\Signup;
use Yii;
use yii\web\Controller;
<?php
namespace App\Commands\Telegram\Bot;
use Telegram\Bot\Keyboard\Keyboard;
class PrivacyCommand extends AbstractCommand
{