From 2bbae04ded53cfb15123652d5bdc491d5b89e093 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 24 May 2022 16:57:39 +0800 Subject: [PATCH] * adjust for tid. --- framework/base/router.class.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 12d5cb577e..3b63bf756a 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -3171,9 +3171,7 @@ class ztSessionHandler ($this->tagID and file_exists($this->rawFile)) ? copy($this->rawFile, $sessFile) : touch($sessFile); } - $sessContent = (string) file_get_contents($sessFile); - if(!file_exists($this->rawFile) and strpos($sessContent, 'user|') !== false) copy($sessFile, $this->rawFile); - return $sessContent; + return (string) file_get_contents($sessFile); } /** @@ -3187,7 +3185,23 @@ class ztSessionHandler public function write($id, $sessData) { $sessFile = $this->getSessionFile($id); - if(file_put_contents($sessFile, $sessData)) return true; + if(file_put_contents($sessFile, $sessData)) + { + if(strpos($sessData, 'user|') !== false) + { + if(file_exists($this->rawFile)) + { + $rawSessContent = (string) file_get_contents($this->rawFile); + if(strpos($rawSessContent, 'user|') === false) copy($sessFile, $this->rawFile); + } + else + { + copy($sessFile, $this->rawFile); + } + } + + return true; + } return false; }