mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Clear out old expired sessions on log out.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
parent
53bb32a15a
commit
cf2a82fe85
2 changed files with 16 additions and 7 deletions
|
@ -3,7 +3,7 @@
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR . '../lang');
|
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR . '../lang');
|
||||||
|
|
||||||
include("aur.inc"); # access AUR common functions
|
include("aur.inc"); # access AUR common functions
|
||||||
include("pkgfuncs_po.inc"); # Add to handle the i18n of My Packages
|
include_once("acctfuncs.inc"); # access AUR common functions
|
||||||
include("logout_po.inc"); # use some form of this for i18n support
|
include("logout_po.inc"); # use some form of this for i18n support
|
||||||
set_lang(); # this sets up the visitor's language
|
set_lang(); # this sets up the visitor's language
|
||||||
|
|
||||||
|
@ -19,8 +19,7 @@ if (isset($_COOKIE["AURSID"])) {
|
||||||
setcookie("AURLANG", "", time() - (60*60*24*30), "/");
|
setcookie("AURLANG", "", time() - (60*60*24*30), "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: index.php');
|
clear_expired_sessions();
|
||||||
exit;
|
|
||||||
|
header('Location: index.php');
|
||||||
|
|
||||||
html_footer(AUR_VERSION);
|
|
||||||
?>
|
|
||||||
|
|
|
@ -625,7 +625,6 @@ function try_login() {
|
||||||
$num_tries = 0;
|
$num_tries = 0;
|
||||||
|
|
||||||
# Account looks good. Generate a SID and store it.
|
# Account looks good. Generate a SID and store it.
|
||||||
#
|
|
||||||
|
|
||||||
$dbh = db_connect();
|
$dbh = db_connect();
|
||||||
while (!$logged_in && $num_tries < 5) {
|
while (!$logged_in && $num_tries < 5) {
|
||||||
|
@ -790,4 +789,15 @@ function user_is_privileged( $id )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
# Clear out old expired sessions.
|
||||||
|
function clear_expired_sessions($dbh) {
|
||||||
|
global $LOGIN_TIMEOUT;
|
||||||
|
|
||||||
|
if (empty($dbh))
|
||||||
|
$dbh = db_connect();
|
||||||
|
|
||||||
|
$q = "DELETE FROM Sessions WHERE LastUpdateTS < (UNIX_TIMESTAMP() - $LOGIN_TIMEOUT)";
|
||||||
|
db_query($q, $dbh);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue