diff --git a/src/controllers/Profile.php b/src/controllers/Profile.php index 70641f0..144c475 100644 --- a/src/controllers/Profile.php +++ b/src/controllers/Profile.php @@ -4,6 +4,7 @@ use Steamy\Core\Controller; use Steamy\Model\User; + class Profile { use Controller; @@ -16,6 +17,12 @@ public function index(): void redirect('login'); } + // log out user if logout button clicked + if (isset($_POST['logout_submit'])) { + $_SESSION = array(); + redirect('login'); + } + // fetch user details from database $current_user = new User(); diff --git a/src/views/Profile.php b/src/views/Profile.php index 5316131..9a50001 100644 --- a/src/views/Profile.php +++ b/src/views/Profile.php @@ -1,6 +1,6 @@

Your account

-

Personal details

+

Personal details

-

Your orders

+

Orders summary

@@ -79,7 +79,9 @@ - - + + + + \ No newline at end of file