Skip to content

Commit

Permalink
Update function.php
Browse files Browse the repository at this point in the history
  • Loading branch information
kasuganosoras committed Oct 25, 2021
1 parent 9dcabb3 commit ee9696f
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion pigeon/function.php
Expand Up @@ -4,7 +4,7 @@ class Pigeon {
public $cacheData;
public $writeToCache;
public $publicMode = true;
public $version = "1.0.176";
public $version = "1.0.177";

/**
*
Expand All @@ -27,6 +27,48 @@ public function __construct() {
}
}

/**
*
* createSession 创建新的会话
*
*/
public function createSession() {
session_start();
if (isset($_SESSION['destroyed'])) {
if ($_SESSION['destroyed'] < time()-300) {
unset($_SESSION['user']);
unset($_SESSION['email']);
unset($_SESSION['token']);
remove_all_authentication_flag_from_active_sessions($_SESSION['userid']);
exit();
}
if (isset($_SESSION['new_session_id'])) {
session_commit();
session_id($_SESSION['new_session_id']);
session_start();
return;
}
}
}

/**
*
* updateSessionId 更新会话 ID
*
*/
public function updateSessionId() {
$new_session_id = session_create_id();
$_SESSION['new_session_id'] = $new_session_id;
$_SESSION['destroyed'] = time();
session_commit();
session_id($new_session_id);
ini_set('session.use_strict_mode', 0);
session_start();
@ini_set('session.use_strict_mode', 1);
unset($_SESSION['destroyed']);
unset($_SESSION['new_session_id']);
}

/**
*
* reCaptcha 验证函数
Expand Down

0 comments on commit ee9696f

Please sign in to comment.