Browse Source

Revert last change, which caused nasty sesion ID errors, although now we still have a problem wherein other cookies that are intentionally set to an empty string are revalued as 'deleted', and the caller may not expect such

pdontthink 18 năm trước cách đây
mục cha
commit
0a3f173e15
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      functions/global.php

+ 3 - 3
functions/global.php

@@ -324,7 +324,7 @@ function sqsession_destroy() {
      * merging of sessions.
      */
 
-    global $base_uri;
+    global $base_uri, $_COOKIE, $_SESSION;
 
     if (isset($_COOKIE[session_name()]) && session_name()) sqsetcookie(session_name(), '', 0, $base_uri);
     if (isset($_COOKIE['username']) && $_COOKIE['username']) sqsetcookie('username','',0,$base_uri);
@@ -378,7 +378,7 @@ function sqsession_start() {
  * @param boolean $bHttpOnly Disallow JS to access the cookie (IE6 only)
  * @return void
  */
-function sqsetcookie($sName,$sValue='',$iExpire=0,$sPath="",$sDomain="",$bSecure=false,$bHttpOnly=true) {
+function sqsetcookie($sName,$sValue='deleted',$iExpire=0,$sPath="",$sDomain="",$bSecure=false,$bHttpOnly=true) {
     // if we have a secure connection then limit the cookies to https only.
     if ($sName && isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) {
         $bSecure = true;
@@ -403,7 +403,7 @@ function sqsetcookie($sName,$sValue='',$iExpire=0,$sPath="",$sDomain="",$bSecure
             $Port = strpos($Domain, ':');
             if ($Port !== false)  $Domain = substr($Domain, 0, $Port);
         }
-        if (!$sValue) $sValue = '';
+        if (!$sValue) $sValue = 'deleted';
         header('Set-Cookie: ' . rawurlencode($sName) . '=' . rawurlencode($sValue)
                             . (empty($iExpires) ? '' : '; expires=' . gmdate('D, d-M-Y H:i:s', $iExpires) . ' GMT')
                             . (empty($sPath) ? '' : '; path=' . $sPath)