[phplib] $sess->mode='post' workaround From: Max Derkachev (kot <email protected>)
Date: 09/20/00

I'm developing workarounds for 'post' mode in session now.
I've desided to use javascript for this, but faced some problems.
initially, the mode is set to 'post'.
$sess->get_id() checks if sess cookie is set, if not, the mode remains
to be 'post', and then it tries to set a sess cookie, and so on.
When it encounters a session in cookies, the mode is switched to
'cookie'.
While the mode remains to be 'post', a class variable $addpost is
appended to urls by the $sess->url() method.
The $addpost variable is being written in $sess->get_id():

switch ($this->mode) {
............
 case "post":
   if ( 0 == $this->lifetime ) {
     SetCookie($this->name, $id, 0, "/", $this->cookie_domain);
   }
   if ( 0 < $this->lifetime ) {
     SetCookie($this->name, $id, time()+$this->lifetime*60, "/",
$this->cookie_domain);
   }

  $this->addpost = " onClick = \"str = '\<form name = \'sess_poster\' id
= \'sess_poster\' "
                    ." action = \''+this.link.href+'\' method = post\>"
                    ."\<input type=\'hidden\' name=\'{$this->name}\'
value=\'$id\'\>"
                    ."\</form\>';"
                    ."document.write(str);"
                    ."document.sess_poster.submit;\"";

 break;
...........

and then, in $sess->url():

 case "post":
        $url = $url . " " . $this->addpost;
 break;

So, we have urls look like:
<a href=someurl onClick = "str = '\<form name = \'sess_poster\' id =
\'sess_poster\' action = \''+this.link.href+'\' method = post\>\<input
type=\'hidden\' name=\'Some_Session\'
value=\'839a5f1c16d882d30830107cca391c18\'\>\</form\>';document.write(str);document.sess_poster.submit;">something</a>

Then, javascript-enabled client should trigger onClick event, and post a
generated form to the url, while those search spiders simply follow the
url.

But something has been screwed up, and the form has not been posted.
Could someone show me where is my mistake?

--
Best regards,
Max A. Derkachev mailto:kot <email protected>
Symbol-Plus Publishing Ltd.
phone: +7 (812) 265-0054, 265-1228, phone/fax: 567-8775
http://www.Books.Ru -- All Books of Russia

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