Re: [phplib-dev] "/sessionid/" way From: Teodor Cimpoesu (teo <email protected>)
Date: 05/25/00

Hi Sebastian!
On Thu, 25 May 2000, Sebastian Bergmann wrote:

> Hi,
>
> what modifications have to be made to PHPLIB in order to handle -
> together with mod_rewrite and an appropriate rewrite rule - to carry the
> session as follows
I think changes in the code would be implied for something like
http://foo.net/index.php/sessionid

for your example you should have some sort of a context e.g.
        http://foo.net/some/path/session/sessionid/page.php
        ..........................^ keyword
the do something like:
        RewriteEngine on
        RewriteLogLevel 0
        #some conditions to avoid useless overhead
        #first one should be quick, so we constrain the set of URIs to
    #something resonable, then see if we have the sessionid inthere
        RewriteCond %{REQUEST_URI} \.php$
        RewriteCond %{REQUEST_URI} .*/session/.*
        RewriteRule ^([^/]+)/session/([^/]+)/(.*)$ $1/$3?sessionid=$2 [QSA,L]

Instead of QSA (query strig append) you could instead set an environment
variable and read it w/ getenv() on the other hand of the story.

You know, your idea can be cool even w/ Cookie sessions ..., avoiding
some work on the PHPLIB side but moving the logic into the rewrite side...
e.g.
        RewriteCond %{REQUEST_URI} \.php$
        RewriteCond %{HTTP:Cookie} sessionid=([^;]+)
        RewriteRule ^([^/]+)/session/(.*)$ $1/$3 [E=sessionid:%1,L]

So the only test now wouls be if sessionid is set in environment
(provided that we used same action in the previous one)

Note I didn't tested any of the above rules :)
I'll try looking at the PHP3 code to see what it would be for change
to make it see foo.php/sessionid/ URL pattern.

> I think this would be a nice improvement for PHPLIB as it gives us the
> same advantages as the patent-protected solution by Sevenval
> (sevenval.com).
again, that would constrain users to :
1. have mod_rewrite installed
2. have access to config file (I think using .htaccess there
are some issues to take into account when rewriting)

-- teodor

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