Skip to content

Commit

Permalink
Add regenerate session after login for fixing possible security issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidsamak committed Oct 3, 2021
1 parent 957014a commit 15d7f58
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pheditor.php
Expand Up @@ -143,6 +143,8 @@
if (empty(PASSWORD) === false && (isset($_SESSION['pheditor_admin']) === false || $_SESSION['pheditor_admin'] !== true)) {
if (isset($_POST['pheditor_password']) && empty($_POST['pheditor_password']) === false) {
if (hash('sha512', $_POST['pheditor_password']) === PASSWORD) {
session_regenerate_id(true);

$_SESSION['pheditor_admin'] = true;

redirect();
Expand Down Expand Up @@ -172,6 +174,8 @@
if (isset($_GET['logout'])) {
unset($_SESSION['pheditor_admin']);

session_destroy();

redirect();
}

Expand Down

0 comments on commit 15d7f58

Please sign in to comment.