diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Session.php | 6 | ||||
-rw-r--r-- | includes/signout_inc.php | 6 | ||||
-rw-r--r-- | includes/templates/header.php | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/includes/Session.php b/includes/Session.php index 967b11b..7951d70 100644 --- a/includes/Session.php +++ b/includes/Session.php @@ -26,6 +26,12 @@ class Session $_SESSION['user_name'] = $user->name; } + public function sign_out() + { + session_unset(); + session_destroy(); + } + public function is_signed_in(): bool { return isset($_SESSION['signed_in']); diff --git a/includes/signout_inc.php b/includes/signout_inc.php deleted file mode 100644 index 7859c4f..0000000 --- a/includes/signout_inc.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -session_start(); -session_unset(); -session_destroy(); -header("Location: ../index.php");
\ No newline at end of file diff --git a/includes/templates/header.php b/includes/templates/header.php index 35d9848..1db9cda 100644 --- a/includes/templates/header.php +++ b/includes/templates/header.php @@ -10,7 +10,7 @@ if (Session::get()->is_signed_in()) { $user = Session::get()->get_current_user(); - echo '[<a href="viewuser.php?id=' . $user->id . '">' . $user->name . '\'s Profile</a>] [<a href="includes/signout_inc.php">Log out</a>]'; + echo '[<a href="viewuser.php?id=' . $user->id . '">' . $user->name . '\'s Profile</a>] [<a href="signout.php">Log out</a>]'; } else { echo '[<a href="signin.php">Sign in</a>] or [<a href="register.php">Register an account</a>]'; } |