|
|
|
@ -91,13 +91,15 @@ trait session_hijacking_functions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If session is not valid, end and redirect to login page. |
|
|
|
// If session is not valid, end and redirect to login page. |
|
|
|
public static function confirm_session_is_valid() { |
|
|
|
public static function confirm_session_is_valid( |
|
|
|
|
|
|
|
string $login = "login.php" |
|
|
|
|
|
|
|
) { |
|
|
|
if (!self::is_session_valid()) { |
|
|
|
if (!self::is_session_valid()) { |
|
|
|
self::end_session(); |
|
|
|
self::end_session(); |
|
|
|
// Note that header redirection requires output buffering |
|
|
|
// Note that header redirection requires output buffering |
|
|
|
// to be turned on or requires nothing has been output |
|
|
|
// to be turned on or requires nothing has been output |
|
|
|
// (not even whitespace). |
|
|
|
// (not even whitespace). |
|
|
|
header("Location: login.php"); |
|
|
|
header("Location: " . $login ); |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -108,13 +110,15 @@ trait session_hijacking_functions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If user is not logged in, end and redirect to login page. |
|
|
|
// If user is not logged in, end and redirect to login page. |
|
|
|
public static function confirm_user_logged_in() { |
|
|
|
public static function confirm_user_logged_in( |
|
|
|
|
|
|
|
string $login = "login.php" |
|
|
|
|
|
|
|
) { |
|
|
|
if (!self::is_logged_in()) { |
|
|
|
if (!self::is_logged_in()) { |
|
|
|
self::end_session(); |
|
|
|
self::end_session(); |
|
|
|
// Note that header redirection requires output buffering |
|
|
|
// Note that header redirection requires output buffering |
|
|
|
// to be turned on or requires nothing has been output |
|
|
|
// to be turned on or requires nothing has been output |
|
|
|
// (not even whitespace). |
|
|
|
// (not even whitespace). |
|
|
|
header("Location: login.php"); |
|
|
|
header("Location: " . $login); |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|