Skip to content

Commit

Permalink
More secure session
Browse files Browse the repository at this point in the history
  • Loading branch information
farisc0de committed Jan 12, 2024
1 parent a8befe1 commit 1663f11
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions uploady/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@
$utils->redirect($utils->siteUrl('/login.php'));
}
}

// Refresh session id every 5 minutes

if (!isset($_SESSION['last_token_refresh'])) {
$_SESSION['last_token_refresh'] = time();
session_regenerate_id(true);
} else {
if (time() - $_SESSION['last_token_refresh'] > 300) {
$_SESSION['last_token_refresh'] = time();
session_regenerate_id(true);
}
}
}

$language = $_GET['lang'] ?? $localization->getLanguage();
Expand Down

0 comments on commit 1663f11

Please sign in to comment.