Commit 5e80a5b1 authored by Ryan Wade's avatar Ryan Wade

Bug Fix: improper function calls from within classes. needed to use $this->

parent 087020df
......@@ -29,25 +29,25 @@
//return true if user has the specified permission level or higher
function hasPermissions($permissions)
{
if($permissions <= getPermissions())
if($permissions <= $this->getPermissions())
return true;
return false;
}
//return number signifying permissions
function getPermissions()
{
if(!isAuthenticated())
if(!$this->isAuthenticated())
return AUTH_LEVEL_NONE;
return $this->SQL_TABLE->GET_FIRST_ROW_BY_ATTRIBUTE(0,$_SESSION["AUTH_user"])->GET_ATTRIBUTE(2);
return $this->SQL_TABLE->GET_FIRST_ROW_BY_ATTRIBUTE(0,$_SESSION["AUTH_User"])->GET_ATTRIBUTE(2);
}
function Authenticate($user, $pass)
{
foreach($this->SQL_TABLE->GET_ROWS() as $candidate)
{
if($candidate->GET_ATTRIBUTE(0) == strtolower($user))
if(strtolower($candidate->GET_ATTRIBUTE(0)) == strtolower($user))
{
$_SESSION["AUTH_User"] = $user;
$_SESSION["AUTH_User"] = $candidate->GET_ATTRIBUTE(0);
if($candidate->GET_ATTRIBUTE(1) == hash('sha256',$pass))
$_SESSION['isAUTHENTICATED'] = true;
else
......@@ -61,5 +61,9 @@
session_destroy();
header("location: ?id=-2");
}
function getUser()
{
return $_SESSION['AUTH_User'];
}
}
?>
\ No newline at end of file
......@@ -45,7 +45,7 @@
}
public function GET_FIRST_ROW_BY_ATTRIBUTE($attr, $id)
{
return GET_ROWS_BY_ATTRIBUTE($attr, $id)[0];
return $this->GET_ROWS_BY_ATTRIBUTE($attr, $id)[0];
}
public function GET_ROWS()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment