emulating enable_trans_sid

From: Date: Mon, 01 Jul 2002 02:48:54 +0000
Subject: emulating enable_trans_sid
Groups: php.general 
Request: Send a blank email to php-general+get-104613@lists.php.net to get a copy of this message
Hi, As discussed a few months back, I'm interested attempting to recreate PHP's enable_trans_sid feature, for users without cookies. ONLY if cookies are UNavailable, I want to open the output buffer, build the page, then run a reg exp or something over the output to append SIDs to all URLs (GET), then print it. I've got a pretty good picture in my head of how I'll test for cookies, and how I'll do the output buffering, but regexp's are NOT my thing :) I'm interested in hearing some opinions on the most efficient way to append the SID to all internal URLs on the page... this would include: - header("Location: something.php") - <A href="something.php"> - <FORM action="something.php"> My thoughts are that it would only be done for relative links (dir/something.php), NOT for fully qualified URLs (http://otherdomain.com, ftp://, mailto:, https://, ?????), as per enable_trans_sid documentation. It would also have to accommodate URLs which already have a query string... if there's an existing query string, just append &SID, otherwise append ?SID. This seems to me like a rather in-depth regexp already, and I'm sure i'm forgetting something. Perhaps there's a simpler way that I'm missing? The only simpler way I can think of would be to search for '.php' and '.php?' and act accordingly, but this has obvious problems when 'something.php' is type, but not in context of a link or header redirection. Where would I look to see the source of enable_trans_sid -- maybe this will give me some hints?? Justin French

« previous php.general (#104613) next »