Commit initial
This commit is contained in:
35
server/webplatform/apps/CameraMonitor/Framework/Session.php
Normal file
35
server/webplatform/apps/CameraMonitor/Framework/Session.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class Session
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
session_start();
|
||||
}
|
||||
|
||||
public function destruct()
|
||||
{
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
public function setAttribute($name, $value)
|
||||
{
|
||||
$_SESSION[$name] = $value;
|
||||
}
|
||||
|
||||
public function existAttribute($name)
|
||||
{
|
||||
return (isset($_SESSION[$name]) && $_SESSION[$name] != "");
|
||||
}
|
||||
|
||||
public function getAttribute($name)
|
||||
{
|
||||
if ($this->existAttribute($name)) {
|
||||
return $_SESSION[$name];
|
||||
}
|
||||
else {
|
||||
throw new Exception("Attribut '$name' absent de la session");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user