File tree Expand file tree Collapse file tree 5 files changed +26
-4
lines changed
Expand file tree Collapse file tree 5 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -1660,6 +1660,11 @@ if [ "$mysql" = 'yes' ]; then
16601660 source $HESTIA_INSTALL_DIR /phpmyadmin/pma.sh > /dev/null 2>&1
16611661fi
16621662
1663+ # ----------------------------------------------------------#
1664+ # Limit PHP SESSIONS #
1665+ # ----------------------------------------------------------#
1666+
1667+ echo " INACTIVE_SESSION_TIMEOUT='60'" >> $HESTIA /conf/hestia.conf
16631668
16641669# ----------------------------------------------------------#
16651670# Configure Admin User #
Original file line number Diff line number Diff line change @@ -1683,6 +1683,11 @@ else
16831683 echo " API='no'" >> $HESTIA /conf/hestia.conf
16841684fi
16851685
1686+ # ----------------------------------------------------------#
1687+ # Limit PHP SESSIONS #
1688+ # ----------------------------------------------------------#
1689+
1690+ echo " INACTIVE_SESSION_TIMEOUT='60'" >> $HESTIA /conf/hestia.conf
16861691
16871692# ----------------------------------------------------------#
16881693# Fix phpmyadmin #
Original file line number Diff line number Diff line change @@ -56,3 +56,6 @@ if [ -f "$apt/postgresql.list" ]; then
5656 sed -i " s/http\:\/\/apt.postgresql.org/https\:\/\/apt.postgresql.org/g" $apt /postgresql.list
5757 fi
5858fi
59+
60+ # Limit PHP Session Live time
61+ echo " INACTIVE_SESSION_TIMEOUT='60'" >> $HESTIA /conf/hestia.conf
Original file line number Diff line number Diff line change 7272 }
7373}
7474
75+ if ( NO_AUTH_REQUIRED !== true ){
76+ if (empty ($ _SESSION ['LAST_ACTIVITY ' ]) || empty ($ _SESSION ['INACTIVE_SESSION_TIMEOUT ' ])){
77+ session_destroy ();
78+ header ("Location: /login/ " );
79+ }else if ($ _SESSION ['INACTIVE_SESSION_TIMEOUT ' ] * 60 + $ _SESSION ['LAST_ACTIVITY ' ] < time ()) {
80+ session_destroy ();
81+ header ("Location: /login/ " );
82+ }else {
83+ $ _SESSION ['LAST_ACTIVITY ' ] = time ();
84+ }
85+ }
86+
7587if (isset ($ _SESSION ['language ' ])) {
7688 switch ($ _SESSION ['language ' ]) {
7789 case 'ro ' :
Original file line number Diff line number Diff line change 11<?php
22
33define ('NO_AUTH_REQUIRED ' ,true );
4-
54// Main include
65include ($ _SERVER ['DOCUMENT_ROOT ' ]."/inc/main.php " );
76
1211 session_destroy ();
1312}
1413
15-
16-
1714// Login as someone else
1815if (isset ($ _SESSION ['user ' ])) {
1916 if ($ _SESSION ['user ' ] == 'admin ' && !empty ($ _GET ['loginas ' ])) {
@@ -116,7 +113,7 @@ function authenticate_user(){
116113 // Define session user
117114 $ _SESSION ['user ' ] = key ($ data );
118115 $ v_user = $ _SESSION ['user ' ];
119-
116+ $ _SESSION [ ' LAST_ACTIVITY ' ] = time ();
120117 // Define language
121118 $ output = '' ;
122119 exec (HESTIA_CMD ."v-list-sys-languages json " , $ output , $ return_var );
You can’t perform that action at this time.
0 commit comments