FreeSTAR-Status-Engine/admin/index.php

73 lines
1.4 KiB
PHP
Raw Normal View History

2017-11-23 18:09:36 -05:00
<?php
2018-01-20 17:01:59 -05:00
if (!file_exists("../config.php"))
2017-11-23 18:09:36 -05:00
{
2018-01-20 17:01:59 -05:00
header("Location: ../");
2017-11-23 18:09:36 -05:00
}
else{
require_once("../config.php");
require_once("../classes/constellation.php");
require_once("../template.php");
2017-11-23 18:09:36 -05:00
if(isset($_COOKIE['user'])&&!isset($_SESSION['user']))
2017-11-23 18:09:36 -05:00
{
User::restore_session();
2017-11-23 18:09:36 -05:00
}
if (!isset($_SESSION['user']))
2018-01-03 08:15:45 -05:00
{
if (isset($_GET['do']) && $_GET['do']=="lost-password")
{
require_once("lost-password.php");
}else if (isset($_GET['do']) && $_GET['do']=="change-email"){
$user_pwd = new User($_GET['id']);
$user_pwd->change_email();
require_once("login-form.php");
}
else{
User::login();
require_once("login-form.php");
}
2018-01-03 08:15:45 -05:00
}
else
{
$user = new User($_SESSION['user']);
if (!$user->is_active())
{
User::logout();
}
2018-01-03 08:15:45 -05:00
if (!isset($_GET['do'])){
$do = "";
}else{
$do = $_GET['do'];
}
2018-01-03 08:15:45 -05:00
switch ($do) {
case 'change-email':
$user = new User($_GET['id']);
$user->change_email();
case 'user':
require_once("user.php");
break;
case 'settings':
require_once("settings.php");
break;
2017-11-23 18:09:36 -05:00
case 'new-user':
require_once("new-user.php");
break;
2017-11-23 18:09:36 -05:00
case 'logout':
User::logout();
break;
2017-11-23 18:09:36 -05:00
default:
require_once("dashboard.php");
break;
}
2017-11-23 18:09:36 -05:00
Template::render_footer(true);
}
2017-11-23 18:09:36 -05:00
}