Session Library



( ZN >= 0.0.1 )

It is a class that brings PHP session operations into a more practical, convenient, and secure way.

 

# Methods


Bool insert ( String $ name , $ value )
Mixed select ( String $ name )
Array selectAll ( Void )
Bool delete ( String $ name )
Bool deleteAll ( Void )
this encode ( String $ name , String $ value )
this decode ( String $ hash )
this regenerate ( Bool $ regenerate = true )

 

# Configuration


File:  ( ZN OE ) Config / Storage.php
String $ encode = 'super' Which algorithm will be used to encrypt session keys. If not specified, no encryption is performed.
Options super , golden , md5 , sha1 ...
Bool $ regenerate = true Status of session ID change. trueIt is preferable for security to be this value .

 

# INI Configuration


Session is the configuration file created to configure the htaccess or php_ini settings of session processes .

File: Settings / Ini.php
In the
Array $ settings = [] php.ini Session settings list. Detailed information on the use of these settings can be found through the PHP Ini Instructions link.
File: Settings / Htaccess.php
.htaccess
Bool $ status = false Specifies whether the settings in the Settings section are saved in the .htaccess file. TRUEthe settings are saved in the .htaccess file. FALSEit simply php_initries to configure it.

 

# Insert ( ZN >= 0.0.1 )


Used to create a session.

Parameters

String $ name Session name.
Mixed $ Value Value.
return Bool

Use of

Session::insert('example', 'Example Data');
echo Session::select('example');
Example Data

Direct Access ( ZN> = 5.2.0 )

Session::example('Example Data');

 

# Select ( ZN >= 0.0.1 )


Used to select created sessions.

Parameters

String $ name Session name.
return Mixed

Use of

Session::insert('example', ['a', 'b', 'c']);
output(Session::select('example'));
0 => string 'a' (length = 3 ) ,
1 => string 'b' (length = 3 ) ,
2 => string 'c' (length = 3 )
 

Direct Access ( ZN> = 5.2.0 )

output(Session::example());

 

# SelectAll ( ZN >= 0.0.1 )


Used to select all created sessions.

Parameters

void
return Array

Use of

Session::insert('example', 'Example Data');
Session::insert('value', 'Value');
output(Session::selectAll());
1a79a4d60de6718e8e5b326e338ae533 => string "Example Data ' (length = 14 ) ,
2063c1608d6e0baf80249c42e2be5804 => string ' value ' (length = 7 )

Direct Access ( ZN> = 5.2.0 )

output(Session::all());

 

# Delete ( ZN> = 0.0.1 )


Used to delete created sessions.

Parameters

String $ name Session name.
return Bool

Use of

Session::delete('example');
output(Session::selectAll());
2063c1608d6e0baf80249c42e2be5804 => string 'Value' (length = 7 )

Direct Access ( ZN> = 5.2.0 )

Session::exampleDelete();

 

# DeleteAll ( ZN >= 0.0.1 )


Used to delete all created sessions.

Parameters

void
return Bool

Use of

Session::deleteAll();
output(Session::selectAll());
array (size = 0) empty

 

# Encode ( ZN >= 3.1.2 )


When creating a session, you can use both the key to hold the value and the value itself to encrypt. Note that key cryptography can be solved while cryptography of value can not be solved . By default, in the Config / Services.php -> session settings, the default encoding setting for encryption of the key is set to md5 .

Parameters

String $ Encode Game Used to encrypt the key that will hold the session value. If left blank, no encryption is made.
String $ Encodevalu to Used to encrypt session data. If left blank, no encryption is made.
return this

Use of

Session::encode('md5')->insert('sessionValue', 'Session Value');
Session::encode('sha1')->insert('sessionValue', 'Session Value');

\Output::writeLine(Session::decode('md5')->select('sessionValue'));
\Output::writeLine(Session::decode('sha1')->select('sessionValue'));
Session Value
Session Value 

 

# Decode ( ZN >= 3.1.2 )


Decrypts the session name encrypted with Session :: encode () . Encryption can not be resolved because it is done in one way for the value.

Parameters

String $ Encode Game Used to encrypt the key that will hold the session value. If left blank, no encryption is made.
return this

Use of

Session::encode('md5')->insert('sessionValue', 'Session Value');

\Output::writeLine(Session::decode('md5')->select('sessionValue'));
Session Value 

The session can be encrypted at will if desired. However, it is not possible to resolve the data in this usage.

Session::encode('md5', 'sha1')->insert('sessionValue', 'Session Value');

\Output::writeLine(Session::decode('md5')->select('sessionValue'));
ed3f3e737cd0b4e396b1350e119a665b156e133 to

 

# Regenerate ( ZN >= 2.0.5 )


Change the current session ID to new. However, since this method is used automatically for the Session library, there is no need to use it again. To ensure that the regenerate process is not done automatically, the true value of Config / Services.php -> session -> regenerate must be set to false .

Parameters

String $ Regenerate Change session ID?
return this

Use of

Session::insert('example', 'Example Data');
Session::regenerate();