Garbage collection for ci_sessions
This commit is contained in:
@@ -8,61 +8,72 @@
|
||||
|
||||
class MY_Controller extends CI_Controller {
|
||||
|
||||
public $authenticated;
|
||||
public $user;
|
||||
public $version;
|
||||
public $authenticated;
|
||||
public $user;
|
||||
public $version;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->version = '1.00.81';
|
||||
$this->version = '1.00.81';
|
||||
|
||||
$this->load->library( 'beheer/session/RetrieveUserSession' );
|
||||
$this->load->library( 'beheer/session/RetrieveUserSession' );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setSecureSite();
|
||||
private function handle()
|
||||
{
|
||||
$this->garbageCiSessions();
|
||||
|
||||
$this->retrieveusersession->handle();
|
||||
$this->setSecureSite();
|
||||
|
||||
$this->user = $this->User_model->get( USERID );
|
||||
}
|
||||
$this->retrieveusersession->handle();
|
||||
|
||||
public function setSecureSite()
|
||||
{
|
||||
if ( getenv( 'ENVIRONMENT' ) != 'production' ) return;
|
||||
$this->user = $this->User_model->get( USERID );
|
||||
}
|
||||
|
||||
if ( ! isset( $_SERVER["HTTPS"] ) || $_SERVER["HTTPS"] != "on" )
|
||||
{
|
||||
header( "Location: " . getenv( 'APP_URL' ) );
|
||||
public function garbageCiSessions()
|
||||
{
|
||||
$number = random_int(0, 100);
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if( $number != 17 ) return;
|
||||
|
||||
function clean_input( $post )
|
||||
{
|
||||
$value = $this->input->input_stream( $post, TRUE );
|
||||
$this->db->query( "DELETE FROM ci_sessions WHERE TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(timestamp), NOW()) > 60" );
|
||||
}
|
||||
|
||||
$denulledValue = str_replace( 'null', '', $value );
|
||||
public function setSecureSite()
|
||||
{
|
||||
if ( getenv( 'ENVIRONMENT' ) != 'production' ) return;
|
||||
|
||||
return $denulledValue;
|
||||
}
|
||||
if ( ! isset( $_SERVER["HTTPS"] ) || $_SERVER["HTTPS"] != "on" )
|
||||
{
|
||||
header( "Location: " . getenv( 'APP_URL' ) );
|
||||
|
||||
public function json( $data )
|
||||
{
|
||||
$this->output
|
||||
->set_content_type( 'application/json' )
|
||||
->set_output( json_encode( $data ) );
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public function unAuthorized()
|
||||
{
|
||||
function clean_input( $post )
|
||||
{
|
||||
$value = $this->input->input_stream( $post, TRUE );
|
||||
|
||||
}
|
||||
$denulledValue = str_replace( 'null', '', $value );
|
||||
|
||||
return $denulledValue;
|
||||
}
|
||||
|
||||
public function json( $data )
|
||||
{
|
||||
$this->output
|
||||
->set_content_type( 'application/json' )
|
||||
->set_output( json_encode( $data ) );
|
||||
}
|
||||
|
||||
public function unAuthorized()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -155,32 +155,32 @@ function setTextAreaHtml( $text )
|
||||
|
||||
function checkBsn( $bsn )
|
||||
{
|
||||
if ( strlen( $bsn ) < 8 || strlen( $bsn ) > 9 )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sum = 0;
|
||||
$counter = strlen( $bsn );
|
||||
$pos = 0;
|
||||
for ( $i = $counter; $i > 0; $i -- )
|
||||
{
|
||||
if ( $i == 1 )
|
||||
{
|
||||
$sum = $sum + intval( $bsn{$pos} ) * - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sum = $sum + ( intval( $bsn{$pos} ) * $i );
|
||||
}
|
||||
$pos ++;
|
||||
}
|
||||
if ( $sum % 11 != 0 )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
// if ( strlen( $bsn ) < 8 || strlen( $bsn ) > 9 )
|
||||
// {
|
||||
// return FALSE;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $sum = 0;
|
||||
// $counter = strlen( $bsn );
|
||||
// $pos = 0;
|
||||
// for ( $i = $counter; $i > 0; $i -- )
|
||||
// {
|
||||
// if ( $i == 1 )
|
||||
// {
|
||||
// $sum = $sum + intval( $bsn{$pos} ) * - 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $sum = $sum + ( intval( $bsn{$pos} ) * $i );
|
||||
// }
|
||||
// $pos ++;
|
||||
// }
|
||||
// if ( $sum % 11 != 0 )
|
||||
// {
|
||||
// return FALSE;
|
||||
// }
|
||||
// }
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user