From: max
Date: Mon Jan 29 10:55:00 2001
Modified files:
php-lib/php/session/session4_custom.inc
Log message:
added support for trans_sid - if the trans_sid_used property is set to true,
url() and friends don't append thes Sess_name=Sess_id to the actual url.
Set it to true only if you're sure that trans_sid feature
actually works in your installation.
Index: php-lib/php/session/session4_custom.inc
diff -u php-lib/php/session/session4_custom.inc:1.5
php-lib/php/session/session4_custom.inc:1.6
--- php-lib/php/session/session4_custom.inc:1.5 Mon Jan 29 10:07:48 2001
+++ php-lib/php/session/session4_custom.inc Mon Jan 29 10:54:59 2001
@@ -9,7 +9,7 @@
* some of the code taken from Teodor Cimpoesu's session4 class
* Copyright (c) 2000 Teodor Cimpoesu <[EMAIL PROTECTED]>
*
- * $Id: session4_custom.inc,v 1.5 2001/01/29 09:07:48 max Exp $
+ * $Id: session4_custom.inc,v 1.6 2001/01/29 09:54:59 max Exp $
*
*/
@@ -35,7 +35,8 @@
var $that;
var $gc_time = 1440; ## Purge all session data older than 1440
minutes.
-
+
+ var $trans_sid_used; // set it to true if PHP is compiled with
+--enable-trans-sid
// compatibility properties
var $fallback_mode;
@@ -102,17 +103,19 @@
* Hint: now PHP has --enable-trans-sid for this
*/
function url ($url) {
- global $HTTP_COOKIE_VARS;
-
- $url=ereg_replace("[&?]+$", "", $url);
- if (strstr($url, $this->name)) return $url;
+ if ($this->trans_sid_used) return $url;
+
+ global $HTTP_COOKIE_VARS;
- if (!$HTTP_COOKIE_VARS[$this->name]) {
- $url .= ( strpos($url, "?") != false ? "&" : "?" )
- . urlencode($this->name)."=".$this->id;
- }
+ $url=ereg_replace("[&?]+$", "", $url);
+ if (strstr($url, $this->name)) return $url;
+
+ if (!$HTTP_COOKIE_VARS[$this->name]) {
+ $url .= ( strpos($url, "?") != false ? "&" : "?" )
+ . urlencode($this->name)."=".$this->id;
+ }
- return $url;
+ return $url;
}
function purl($url) {
@@ -120,8 +123,8 @@
}
function self_url() {
- global $SCRIPT_NAME, $QUERY_STRING;
- return $this->url($SCRIPT_NAME.
+ global $PHP_SELF, $QUERY_STRING;
+ return $this->url($PHP_SELF.
((isset($QUERY_STRING) && ("" != $QUERY_STRING)) ?
"?".$QUERY_STRING : ""));
}
@@ -133,7 +136,8 @@
* Stores session id in a hidden variable (part of a form)
*/
function get_hidden_session() {
- return
+ if ($this->trans_sid_used) return;
+ return
sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\">\n",
$this->name,
$this->id
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]