Skip to content

Instantly share code, notes, and snippets.

View terion-name's full-sized avatar

Terion terion-name

View GitHub Profile
@terion-name
terion-name / RedirectAjax.php
Last active December 20, 2015 06:39
Laravel 4 lib that provides AJAX redirects in Redirector. Put it in /app/lib/RedirectAxax directory; add "app_path().'/lib'" to ClassLoader in /start/global.php; bind alias in /app/config/app.php: 'Redirect'=> 'RedirectAjax\RedirectAjax'. After that redirects called in ajax requests will output JSON: {"redirect":"http://example.com"}. Also jQuer…
<?php namespace RedirectAjax;
class RedirectAjax extends \Illuminate\Support\Facades\Redirect {
public static function __callStatic($method, $args) {
\App::bind('redirect', function($app)
{
$redirector = new Redirector($app['url']);
@terion-name
terion-name / MY_Session.php
Last active June 23, 2022 18:17
Codeigniter 2 Redis Sessions. In fact it is just modified system session library, that in case of setting "use_database" to TRUE will use Redis instead of SQL db. Requires *https://github.com/nrk/predis* (can be modified for usage with *https://github.com/nicolasff/phpredis* just by changing multiExec() to multi() and execute() to exec()). Put p…
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session {
var $sess_encrypt_cookie = FALSE;
var $sess_use_database = FALSE;
var $sess_table_name = '';
var $sess_expiration = 7200;
var $sess_expire_on_close = FALSE;
var $sess_match_ip = FALSE;