Skip to content

Instantly share code, notes, and snippets.

View BAHC's full-sized avatar

BAHC

View GitHub Profile
@BAHC
BAHC / exchange_rate.php
Last active June 28, 2018 19:54
Exchange Rates
<?php
function exchange_rate($_opt = [])
{
$_pairs = [];
foreach($_opt as $_k=>$_v)
{
$_pairs[] = $_k.'_'.$_v;
}
if(!count($_pairs)) return null;
@BAHC
BAHC / turkey_exchange_rate.php
Created June 28, 2018 11:04
Turkish Lira Official Exchange Rate
<?php
/**
* Turkish Lira Official Exchange Rate
**/
function turkey_exchange_rate($_opt='', $_signs = 2)
{
$res = null;
$url = 'http://www.tcmb.gov.tr/kurlar/today.xml';
$xml = @simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA);
@BAHC
BAHC / ICSessions.php
Created June 28, 2018 13:59
Sessions
<?php
class ICSessions
{
static public function Init(){
if (!session_id()) @session_start();
return new ICSession;
}
public function Set($key='', $value='')
{
@BAHC
BAHC / get_exchange_rate_for_one_pair.php
Last active June 28, 2018 20:09
Get Exchange Rate For One Pair In One Direction
<?php
require 'exchange_rate.php';
function get_exr($_from=null, $_to=null)
{
$_res = null;
$_pair = $_from.'_'.$_to;
$_pairs = exchange_rate([ $_from => $_to ]);
if(is_array($_pairs) && isset($_pairs[$_pair]))
{
@BAHC
BAHC / cmsif_primer.php
Last active July 3, 2018 02:10
CMSIF Primer
<?php
require __DIR__.'/cmsif.php';
init();
/**/
//Simple route to include module file
router('get', '/about', CMSIF_MODULES.'/about.php');
//Simple HTML page
@BAHC
BAHC / Stars 19
Last active December 22, 2018 08:35
<?php
/**
* Привет в 2019 из книги 2008 года
* Андрей Богатырев. Руководство полного идиота
* по программированию (на языке Си)
* http://lib.ru/CTOTOR/starterkit.txt
*/
define("LINES", 19);
<script>
var Slides = {};
Slides.tDuration = 1.75 * 1000;
Slides.bgLg = "https://yachtering.eu/img/slides_20min_big.png?201903031805";
Slides.bgSm = "https://yachtering.eu/img/slides_20min.png?201903031805";
Slides.imgHSm = 75;
Slides.imgWSm = 75;
@BAHC
BAHC / erp_category.php
Last active May 1, 2019 01:33
ERP Category
<?php
$xml = file_get_contents("erp_category.xml");
$xml = str_replace(PHP_EOL, '', $xml);
$xml = str_replace( "\t", '', $xml);
$xml = str_replace(' ', ' ', $xml);
$xml = str_replace('<Категория_1', "\n\n".'<Категория_1', $xml);
$xml = str_replace('</Категория_1>', '</Категория_1>'."\n\n", $xml);
@BAHC
BAHC / mailer.php
Last active May 1, 2019 10:45
Mailer for Yesbol
<?php
//....
$pass = 'qwertyqwerty';
//$row['user_mail'] = 'wans@localhost';
//$row['id_user'] = 1;
$link = 'http://elink.kz/respass/reset/code/'.md5($pass).'/'.$row['id_user'];
public function __construct()
{
$this->clients = new \SplObjectStorage;
$this->connectedUsers = [];
$this->connectedIDs = [];
$this->IDs = 0;
}
public function onOpen(ConnectionInterface $conn)
{