Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout #28

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions controller/logout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
require('model/model.php');
require('dbConnection.php');

$conn = mysqli_connect(SERVER_ADDRESS,USER_NAME,PASSWORD,DATABASE);

require('middleware/authMiddleware.php');

echo json_encode(array("status" => true, "msg" => "Successfully Log Out"));

session_destroy();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Control flow error !!!
session can't be started or destroyed after sending message to the browser - as they deal with headers.
Line 11 can't come after line 9.
It's pure logical error ( man your'e sending status true even before destroying session ??!!)
Resubmit the PR.


?>