summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-04-25 17:43:37 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-04-25 17:43:37 -0600
commit2d5cf9448edb1eb6785c1532ccb031b0ba0d1ef0 (patch)
tree2bf099704c5665f66c0bd2a18b7c4599ec397ffa
parent08561be92bbfafe149b758634f3df4d00ee310de (diff)
Remove old signout_inc.php file
-rw-r--r--includes/Session.php6
-rw-r--r--includes/signout_inc.php6
-rw-r--r--includes/templates/header.php2
-rw-r--r--signout.php16
4 files changed, 23 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>]';
}
diff --git a/signout.php b/signout.php
new file mode 100644
index 0000000..035877b
--- /dev/null
+++ b/signout.php
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Sign out - cflip.net forums</title>
+ <link rel="stylesheet" href="styles/style.css">
+</head>
+<body>
+<?php
+include_once './includes/Session.php';
+Session::get()->sign_out();
+
+include_once './includes/templates/header.php';
+echo '<p class="success">You have now been signed out</p>';
+?>
+</body>
+</html> \ No newline at end of file