mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-06-26 11:26:17 +00:00
Start on rewriting classes for de-oopsie-ing
This commit is contained in:
parent
be7d4b5b43
commit
7f1782d7c6
1 changed files with 11 additions and 5 deletions
16
app/app.php
16
app/app.php
|
@ -106,11 +106,17 @@ class Account {
|
|||
Returns True if user is
|
||||
Returns False if user is NOT
|
||||
*/
|
||||
function is_loggedin() {
|
||||
if (isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true) {
|
||||
return True;
|
||||
function is_loggedin($conn) {
|
||||
$error = 0;
|
||||
|
||||
if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] == false) $error += 1;
|
||||
|
||||
if (empty($this->get_user_info($conn, $_SESSION["id"])) || $this->get_user_info($conn, $_SESSION["id"]) == null) $error += 1;
|
||||
|
||||
if ($error > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return False;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -143,7 +149,7 @@ class Account {
|
|||
Returns False if user is NOT privilaged
|
||||
*/
|
||||
function is_admin($conn, $id) {
|
||||
if (isset($id) || !empty($id)) {
|
||||
if (isset($id) && !empty($id)) {
|
||||
// Setting SQL query
|
||||
$sql = "SELECT admin FROM users WHERE id = ?";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue