PHP4b3 trans-sid doesn't parse URLs HREF=# or FORM...ACTION=
| From: | Chris Shenton | Date: | Tue, 15 Feb 2000 04:37:35 +0000 |
| Subject: | PHP4b3 trans-sid doesn't parse URLs HREF=# or FORM...ACTION= | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-10283@lists.php.net to get a copy of this message | ||
[should this be filed with the bug reporter gadget instead of here?]
Been making use of PHP4b3's session tracking features, and loving it.
Now when I turn off cookies in the browser, to see how some of our
users will experience it, some things break. Specifically, I've found
that neither HTML references of the form
<A HREF=#label>
nor
<FORM ... ACTION=filename.php?Variable=Value>
get parsed. I did the config to turn on the trans-sid:
# ./configure --with-apache=../apache_1.3.11
--with-mysql
--enable-trans-sid
--enable-track-vars
and it does translate most the URLs on the fly (cool!). But I'm having
to do contortions to get the others to work. Commented sample code
fragments follow for each case description.
Below, I had to change relative HTML label finding from
<A HREF=#label>
to
<A HREF=$PHP_SELF?Variable=Value#label>
to get the SID expansion to work. Just using HREF=$PHP_SELF?#label
failed.
// "#"-style references don't get parsed correctly by PHP:
// <a href=#Files>Manage Files</a>
// becomes
// <a href=?PHPSESSID=2e408032c0bc0882fe1fdaa7edd96791#Files>Manage Files</a>
echo "<P ALIGN=CENTER>
<a href=$PHP_SELF?Function=Nop#Files>Manage Files</a>
| <a href=$PHP_SELF?Function=Nop#Addresses>Manage Recipients</a>
| <a href=$PHP_SELF?Function=Nop#ChangePassword>Change Password</a>
| <a href=$PHP_SELF?Function=Nop#UsernameChange>Change Username</a>
| <a href=logout.php>LogOut</a>";
This is kind of ugly because instead of directing the browser to
scroll to find the label, it causes the browser to go back to the
server again; much slower.
For forms like below, I found that I had to replace styles like:
<FORM ... ACTION=filename.php?Variable=Value>
with a variant with the SID constant appended as an extra variable:
<FORM ... ACTION=filename.php?Variable=Value>
Code sample:
// The SUBMIT buttons don't get the URL parsed to add the SESSIONID info:
// <FORM METHOD=POST ENCTYPE=multipart/form-data
// ACTION=filename.php?Function=FileUpload>
// Is this because they don't have an HREF= for PHP to find and parse?
// Workaround: jam the session ID constant; what if we do allow cookies??
echo "<FORM METHOD=POST ENCTYPE=multipart/form-data
ACTION=$PHP_SELF?Function=FileUpload&". SID .">"
Are there better work arounds for this? Would writing the URLs in the
relative-label or FORM...ACTION statements different allow the parser
to notice these?
Thanks.