-
- class CommAction extends Action {
- public function __construct() {
- parent::__construct();
- $this->checkAdminSession();
- }
-
- public function checkAdminSession() {
- //Set the timeout to 10 minutes
- $nowtime = time();
- $s_time = $_SESSION['logintime'];
- if (($nowtime - $s_time) > 600) {
- unset($_SESSION[' logintime']);
- $this->error('The current user is not logged in or the login has timed out, please log in again', U('login/loginpage'));
- } else {
- $_SESSION['logintime'] = $nowtime;
- }
- }
- }
- ?>
-
Copy code
If it is a process-oriented program, write a session.inc.php, write the program judgment in this file, and then other files Just include it.
|