Sessions are used in PHP to provide a method to track a user throughout a website and pass data between pages about that user during their time on the site.
A unique ID is assigned to the user and the data is stored on the server itself, rather than on the user's computer such as with cookies.
The most common form of session usage is for commerce sites and the ability to have a shopping cart, user login and customized interfaces, and navigation history.
Typischer Ablauf mit Session Variablen
// Session startenDie Sessionvariablen werden am Server gespeichert und können jederzeit aufgerufen werden. Bei diesem Beispiel wird die Anzahl der Fehlversuche mitprotokolliert.
Richtiger Benutzer: Hans
Richtiges Passwort: Hinterseer
Erstelle eine Seite mit einem Login-Formular und eine Seite mit Inhalten.
Zuatz: Erstellen in der Datenbank eine Tabelle mit Benutzern mit unterschiedlichen Rechten: