oscommerce + register_globals 更新

前面的register_globals v1.5的版本還是有蟲,所以要更改includes/functions/session.php及admin/includes/functions/session.php這兩個檔。

這個函式有問題,要改成下面這個:
function link_session_variable($var_name, $map)
  {
    if ($map)
    {
      // Map global to session variable. If the global variable is already set to some value
      // then its value overwrites the session variable. I **THINK** this is correct behaviour
      if (array_key_exists($var_name,$GLOBALS)) {
        $_SESSION[$var_name] =& $GLOBALS[$var_name];
      } else {
        $GLOBALS[$var_name] =& $_SESSION[$var_name];
      }
    }
    else
    {
      // Unmap global from session variable. Note that the global variable keeps the value of
      // the session variable. This should be unnecessary but it reflects the same behaviour
      // as having register_globals enabled, so in case the OSC code assumes this behaviour,
      // it is reproduced here
      $nothing = 0;
      $GLOBALS[$var_name] =& $nothing;
      unset($GLOBALS[$var_name]);
      $GLOBALS[$var_name] = $_SESSION[$var_name];
    }
  }

這個函式也有問題,要改成下面這個:
function tep_session_is_registered($variable) {
// >>> BEGIN REGISTER_GLOBALS
//    return session_is_registered($variable);
    return array_key_exists($variable,$_SESSION);
// <<< END REGISTER_GLOBALS
  }

感謝你看到這裡,很快就可以離開了,但最好的獎勵行動就是按一下幫我分享或留言,感恩喔~

點我分享到Facebook

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *