Added input handler, redirector, session handler, and token handler.
This commit is contained in:
42
Core/Session.php
Normal file
42
Core/Session.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace Core;
|
||||
|
||||
class Session
|
||||
{
|
||||
public static function exists($name)
|
||||
{
|
||||
return (isset($_SESSION[$name])) ? true : false;
|
||||
}
|
||||
|
||||
public static function put($name, $value = '')
|
||||
{
|
||||
return $_SESSION[$name] = $value;
|
||||
}
|
||||
|
||||
public static function get($name)
|
||||
{
|
||||
return $_SESSION[$name];
|
||||
}
|
||||
|
||||
public static function delete($name)
|
||||
{
|
||||
if(self::exists($name))
|
||||
{
|
||||
unset($_SESSION[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function flash($name, $string = '')
|
||||
{
|
||||
if(self::exists($name))
|
||||
{
|
||||
$session = self::get($name);
|
||||
self::delete($name);
|
||||
return $session;
|
||||
}
|
||||
else
|
||||
{
|
||||
self::put($name, $string);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user