Skip to content

reference:Session variables

Aaron Junker edited this page Apr 17, 2021 · 5 revisions

Session variables

This is a list of all used session variables in USOC.

You can access them via the magic array $_SESSION[""].

Usage

Session variables should be used to save something temporarily in the user session. For example when a 2fa code gets requested.

Don't always trust the session variables. For example you can trust on $_SESSION["PermissionLevel"] to show the button to the backend, but if the user wants to access the backend you should double check if he has the permission to do so.

All variables get unset in (root) /logout.php

Variables

Name Description Set in...
PermissionLevel The permission level of the currently logged in user. (root) /localSettings.php sets it to 0 (Visitor level) if the user isn't logged in. (root) /login /login.php sets it when user gets logged in.
User_ID The Id of the logged in user as md5 hash. (root) /login /login.php sets it when user gets logged in.
User_Name The username of the logged in user (root) /login /login.php sets it when user gets logged in.
temp_User_ID The Id of the logged in user as md5 hash, if the user needs to be authenticated with 2fa. (root) /login /login.php sets it when user gets logged in.
temp_User_Name The username of the logged in user, if the user needs to be authenticated with 2fa. (root) /login /login.php sets it when user gets logged in.
Clone this wiki locally