Fixed up users page a little, still need editing...

This commit is contained in:
Josh North 2015-02-19 10:56:49 -05:00
parent 1dc1badd8c
commit fe4d056591

View File

@ -17,26 +17,37 @@
$yaptc_lib = $yaptc_dirpath . 'lib/';
$yaptc_libweb = $yaptc_webpath . 'lib/';
function getSessionStatus(){
if (!isset($_SESSION['user_id']) || !isset($_SESSION['signature']) || !isset($_SESSION['loggedIn']) || $_SESSION['loggedIn'] != true || $_SESSION['signature'] != md5($_SESSION['user_id'] . $_SERVER['HTTP_USER_AGENT']))
// Get login status - returns true or false
function getSessionStatus()
{
if (!isset($_SESSION['user_id']) || !isset($_SESSION['signature']) || !isset($_SESSION['loggedIn']) || $_SESSION['loggedIn'] != true || $_SESSION['signature'] != md5($_SESSION['user_id'] . $_SERVER['HTTP_USER_AGENT'])) {
return false;
} else {
return true;
}
}
function getSessionAccess($sql){
if (isset($_SESSION['user_id']))
// Kick user and go to login
function killSession()
{
session_unset();
session_destroy();
session_write_close();
header("Location: login.php");
}
// Get user access level. Call with $sql passed or it will not work correctly
function getSessionAccess($sql)
{
if (isset($_SESSION['user_id'])) {
$query3 = "SELECT users.id as userid, usertypes.typename AS usertype FROM users, usertypes WHERE users.id = :id";
$stmt3 = $sql->prepare($query3);
$stmt3->execute(array(':id' => $_SESSION['user_id']));
$stmt3->execute(array(
':id' => $_SESSION['user_id']
));
$user3 = $stmt3->fetchObject();
return $user3->usertype;
}
}
?>