MINT-Projekt/class/Session.php
eichehome 20cb808935 Kommentare in Session.php
Habe Kommentare in Session.php modifiziert
2022-01-23 12:17:55 +01:00

71 lines
No EOL
1.7 KiB
PHP

<!DOCTYPE html>
<?php
/*
* Copyright (C) 2021 Eichehome
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Wrapper für eine Session
*
* @author Eichehome
*/
class Session
{
/**
* Konstruktor (Startet eine Session)
*/
public function __construct()
{
$this->start();
}
/**
* Setzt einen Wert für einen Schlüssel im Session-Array. Falls kein Wert angegeben, wird der Wert gelöscht
* @param string $key Schlüssel
* @param string $value Wert
* @return string
*/
public function set(String $key, String $value = "")
{
return $_SESSION[$key] = $value;
}
/**
* Gibt den Wert für einen Schlüssel im Session-Array zurück
* @param string $key Schlüssel
* @return string
*/
public function get(String $key)
{
return $_SESSION[$key];
}
/**
* Zerstört eine Session und ihre Werte
*/
public function destroy()
{
session_destroy();
}
/**
* Startet eine Session
*/
public function start()
{
session_start();
}
}