phpbar.de logo

Mailinglisten-Archive

[php] Session-ID im Pfadnamen

[php] Session-ID im Pfadnamen

Andreas Lange php_(at)_phpcenter.de
Mon, 20 Aug 2001 13:52:00 +0200


> RewriteEngine On
> RewriteRule ^[0-9a-z]{32}/(.*)$ /$1 [L]
>=20
> <?php
>=20
> function session_start_from_rewrite() {
> 	global $HTTP_HOST, $REQUEST_URI;
> 	ereg("/([0-9a-z]{32})",$REQUEST_URI, $regs);
> 	$session_id =3D $regs[1];
> 	if(!isset($session_id) || empty($session_id)) {
> 		srand((double)microtime()*1000000);
> 		$session_id =3D md5(uniqid(rand()));
> 		$destination =3D=20
> "http://$HTTP_HOST/$session_id$REQUEST_URI";
> 	=09
> header("Location: $destination");
> 	}
> 	session_id($session_id);
> 	session_start();=20
> }
>=20
> session_start_from_rewrite();
>=20
> ?>

Danke f=FCr die schnelle Antwort :)

Andreas Lange



php::bar PHP Wiki   -   Listenarchive