[phplib] mod_rewrite for sessionids From: messju mohr (messju <email protected>)
Date: 08/24/00

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I implemented propagation of session-IDs in the URL of the requested page.
By this you kann simply address your pages via relative links and always keep
your session-ID from one page to another. You don't need cookies or
$sess->purl() all the time.

It was inspired by an example in the book "Web Application development with PHP
4.0" by Tobias Ratschiller in the Chapter "Web Application Concepts - HTTP and
Sessions" and needs mod_rewrite.

A patch to session.inc (I used php-lib-stable/php/session.inc from the
CVS-Repository) is included in this mail, since it is really small.

I introduced a third $mode named "rewrite" in the Session class.
You can set a variable "rewrite_base" which specifies the PATH before
the "[session_id]/" part in the URL. rewrite_base defaults to "/" if not set.

You have to put something like:

  RewriteEngine on
  RewriteBase /
  RewriteRule ^[0-9a-z]{32}/(.+) /$1

or

  RewriteEngine on
  RewriteBase /
  RewriteRule ^(your_rewrite_base)[0-9a-z]{32}/(.+) $1$2

in your httpd.conf in addition to your common php-lib-setup.

A demonstration can be found at:
http://messju.internet-factory.de:42000/rewrite/session.php

If you have any suggestions or comments feel free to email me.

I hope I can contribute with that to the development of php-lib. php-lib is
great software that makes web application development being fun. All you
guys do a great job.

And of course I really appreciate it, if something like the "rewrite"-mode
would go in the official php-lib distributions. :)

regards
messju mohr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: PGPEnvelope - http://www.bigfoot.com/~ftobin/resources.html

iD8DBQE5pVWVubKPpFA4n0URAmLoAJ9xnLKtY3dexhZsBSGzmJh9m5/MrgCfXJv9
AviWeHLq9WfWBre4InANvMA=
=S6ZZ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>