48 ini_set(
"session.cookie_httponly", 1);
50 ini_set(
"session.hash_bits_per_character",
"4");
53 session_name(isset($sessionName)
62 if (strlen(session_id()) < 32)
64 mt_srand ((
double)microtime()*1000000);
65 session_id(md5(uniqid(mt_rand())));
71 if ( isset(
$_COOKIE[session_name()]) &&
72 @strlen(
$_COOKIE[session_name()]) >= 32
75 if ( isset(
$_POST[session_name()]) &&
76 @strlen(
$_POST[session_name()]) >= 32
79 if ( isset(
$_GET[session_name()]) &&
80 @strlen(
$_GET[session_name()]) >= 32
88 $query = @
$_SERVER[
"QUERY_STRING"] !=
"" ?
"?".$_SERVER[
"QUERY_STRING"] :
"";
90 header(
"Status: 302 Found");
106 ### ------------------------------------------------------- 116 header(
"Expires: Sat, 05 Aug 2000 22:27:00 GMT");
117 header(
"Last-Modified: " . gmdate(
"D, d M Y H:i:s") .
" GMT");
118 header(
"Cache-Control: no-cache, must-revalidate");
119 header(
"Pragma: no-cache");
120 header(
"Cache-Control: post-check=0, pre-check=0");
123 ### ------------------------------------------------------- 140 if ($pathInfo[0] !=
"/")
141 { $pathInfo = substr(getenv(
"PATH_INFO"),
143 strrpos(getenv(
"PATH_INFO"),
"/")+1
149 $port = !preg_match(
"/^(80|443)$/",
150 getenv(
"SERVER_PORT"),
152 ?
":".getenv(
"SERVER_PORT")
157 .(($portMatch[1] == 443) ?
"https://" :
"http://")
158 .
$_SERVER[
"HTTP_HOST"].$port.$this->url($pathInfo));
162 ### ------------------------------------------------------- 170 $dummy = preg_match(
"/(.*)(?<!&|\?)/",$pathInfo,$match);
174 ### ------------------------------------------------------- 182 if ($this->usesCookies || $this->transSID)
return $pathInfo;
185 $dummyArray = split(
"#",$pathInfo);
186 $pathInfo = $dummyArray[0];
189 $pathInfo = preg_replace(
"/[?|&]".session_name().
"=[^&]*/",
194 if (preg_match(
"/&/",$pathInfo) && !preg_match(
"/\?/",$pathInfo))
197 $pathInfo = preg_replace(
"/&/",
"?",$pathInfo,1);
204 $pathInfo .= preg_match(
"/\?/",$pathInfo) ?
"&" :
"?";
205 $pathInfo .= session_name().
"=".session_id();
208 $pathInfo .= isset($dummyArray[1]) ?
"#".$dummyArray[1] :
"";
213 ### ------------------------------------------------------- 224 if ($this->usesCookies || $this->transSID)
return "";
225 return "<INPUT type=\"hidden\" 226 name=\"".session_name().
"\" 227 value=\"".session_id().
"\">";
url($pathInfo)
Fallback via GET - wenn Cookies ausgeschaltet sind.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
hidden()
Fallback via HIDDEN FIELD - wenn Cookies ausgeschaltet sind.
sendNoCacheHeader()
Cacheing unterbinden.
redirectTo($pathInfo)
HTTP-Redirect ausführen (header("Location: ...")
removeTrail($pathInfo)
Entfernt mögliche abschließende "&" und "?".
"Manueller" Session-Fallback mit PHP4
Session($sessionName="SESSID")
Konstruktor - nimmt, wenn gewuenscht einen neuen Session-Namen entgegen.