Date: 01/10/01
- Next message: Mark Heintz PHP Mailing Lists: "Re: [phplib] template: / in varname"
- Previous message: Max A. Derkachev: "Re: [phplib] PHPlib: Additional Username"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,
i'd like to use session management with php4, but i wanna
use the fallback function of phplib, too (if no cookies,
then get).
I've tried to do with class.Session.inc „manual“
Session Fallback with PHP4 Version 1.02 - > - 071100/00:38
written by Daniel T. Gorski (sourcecode see below).
But then any site tries to set a cookie again, in phplib
it was many more comfortable.
So my question is: where is the problem?
How can i solve it?
1000 thanx for any help.
Best regards,
harald morgenstern
><?php
>// Datei: class.Session.inc
>// Benötigt: mind. 4.0.1pl2
>/**
>* "Manueller" Session-Fallback mit PHP4
>*
>* <email protected> Daniel T. Gorski <daniel.gorski <email protected>>
>* <email protected> 1.02 - 071100/00:38
>*/
>class Session {
> var $version = 102; // V1.02
> var $usesCookies = false; // Client nimmt Cookies an
> var $transSID = false; // Wurde mit --enable-trans-sid
> // kompiliert
>### -------------------------------------------------------
>/**
>* Konstruktor - nimmt, wenn gewünscht einen
>* neuen Session-Namen entgegen
>*/
>function Session($sessionName="SESSID") {
> global $HTTP_POST_VARS,$HTTP_GET_VARS,
> $HTTP_COOKIE_VARS,$QUERY_STRING,$PHP_SELF;
> $this -> sendNoCacheHeader();
> // Session-Namen setzen, Session initialisieren
> session_name(isset($sessionName) ? $sessionName : session_name());
> <email protected>();
> // Prüfen ob die Session-ID die Standardlänge von 32 Zeichen hat,
> // ansonsten Session-ID neu setzen
> if (strlen(session_id()) != 32)
> {
> mt_srand ((double)microtime()*1000000);
> session_id(md5(uniqid(mt_rand())));
> }
> // Prüfen, ob eine Session-ID übergeben wurde
> // (über Cookie, POST oder GET)
> if ( <email protected>($HTTP_COOKIE_VARS[session_name()]) != 32 &&
> <email protected>($HTTP_POST_VARS [session_name()]) != 32 &&
> <email protected>($HTTP_GET_VARS [session_name()]) != 32)
> {
> // Es wurde keine (gültige) Session-ID übergeben.
> // Script-Parameter der URL zufügen
> $query = @$QUERY_STRING != "" ? "?".$QUERY_STRING : "";
> header("Status: 302 Found");
> $this -> redirectTo($PHP_SELF.$query); // Script terminiert
> }
> // Wenn die Session-ID übergeben wurde, muß sie
> // nicht unbedingt gültig sein!
> // Für weiteren Gebrauch merken
> $this -> usesCookies =
> <email protected>($HTTP_COOKIE_VARS[session_name()]) == 32;
>}
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Mark Heintz PHP Mailing Lists: "Re: [phplib] template: / in varname"
- Previous message: Max A. Derkachev: "Re: [phplib] PHPlib: Additional Username"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

