diff options
Diffstat (limited to 'includes/session.php')
-rw-r--r-- | includes/session.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/includes/session.php b/includes/session.php new file mode 100644 index 0000000..ef1f84d --- /dev/null +++ b/includes/session.php @@ -0,0 +1,26 @@ +<?php + +// Insert here the code that validates the user session +if ($_SERVER['REMOTE_ADDR'] !== "127.0.0.1" && $_SERVER['REMOTE_ADDR'] !== "::0") { + if (isset($_COOKIE['FL_SESSION_TOKEN'])) { + if (file_exists("/mnt/familine/private/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['FL_SESSION_TOKEN'])))) { + $_PROFILE = json_decode(file_get_contents("/mnt/familine/private/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['FL_SESSION_TOKEN']))), true); + + if (isset($_PROFILE['familine'])) { + header("Location: https://familine.minteck.org/welcome"); + die(); + } + + $_USER = $_PROFILE['login']; + $_SUID = $_PROFILE['login']; + $_FULLNAME = $_PROFILE['name']; + } else { + header("Location: https://familine.minteck.org/welcome"); + die(); + } + } else { + header("Location: https://familine.minteck.org/welcome"); + die(); + } + +} |