phpbar.de logo

Mailinglisten-Archive

[php] PHP - MOD_REWRITE - SESSIONS

[php] PHP - MOD_REWRITE - SESSIONS

Tobias Orterer php_(at)_phpcenter.de
Sun, 12 May 2002 16:18:11 +0200


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

Hab damit mal rum experimentiert. Das mußte in nen 
File schreiben und dann auto_includen lassen ;o)
Rest siehste dann schon.


php::bar PHP Wiki   -   Listenarchive