On Thu, Apr 25, 2002 at 03:04:36PM +0200, Harald Radi wrote:
> sounds very useful, go ahead ;)
>
> would you mind extending it that session_set_userdata(array("thies" =>
> "1", "harald" => "2", "knorp" => "100")) would be possible ?
nope - that would make the url_scanner slower.
but you can always ancode as much data as you want into the
one userdata var.
tc
>
> harald.
>
> "Thies C. Arntzen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:<[EMAIL PROTECTED]>...
> >
> > hi,
> >
> > i have made a small patch to the session-module which allows
> > the script to inject some user-defined data into the
> > url_rewriter.
> >
> > why do i need this?
> > - i want to be able to open a 2nd browserwindow
> > - this window will use the same session as the 1st one
> > - i need to be able to differentiate the two windows on the
> > PHP side
> >
> > right now the session module can "only" store one cookie (or
> > one info in trans-sid) my patch extends that to one
> > user-defined variable so that:
> >
> > <?php
> > session_start();
> > session_set_userdata("thies", "1");
> > ?>
> > <a href=test.php>test</a>
> >
> > <form>
> > <input type=text>
> > <input type=submit>
> > </form>
> >
> > will generate:
> >
> > <a
> > href="test.php?MOFL=34b91e4e3d0974c3722c1298172dfb08&thies=1">test</a>
> >
> > <form><input type="hidden" name="MOFL"
> > value="34b91e4e3d0974c3722c1298172dfb08" /><input type="hidden"
> > name="thies" value="1" />
> > <input type=text>
> > <input type=submit>
> > </form>
> >
> > as you can see "thies" = "1" will now be kept on the page.
> >
> > so to open a new window _and_ have a unique identifier for
> > each openend window you would do something like:
> >
> > --------------------------------------------------------------------
> > <?php
> > session_start();
> >
> > if (! isset($_SESSION[ 'mydata' ])) {
> > $_SESSION[ 'mydata' ] = array();
> > }
> >
> > if (isset($_REQUEST[ 'newwindow' ])) {
> > $windowid = time();
> > } elseif (isset($_REQUEST[ 'windowid' ])) {
> > $windowid = $_REQUEST[ 'windowid' ];
> > } else {
> > $windowid = 0;
> > }
> > session_set_userdata("windowid", (string) $windowid);
> >
> > if (! isset($_SESSION[ 'mydata' ][ $windowid ])) {
> > $_SESSION[ 'mydata' ][ $windowid ] = 0;
> > }
> >
> > echo "clicks in this window ". ++$_SESSION[ 'mydata' ][ $windowid
> > ]."<br>"; ?> <a href="test.php?newwindow=1" target=0>New Window</a>
> >
> > testform:
> > <form>
> > <input type=text>
> > <input type=submit>
> > </form>
> > --------------------------------------------------------------------
> >
> > is it OK to commit?
> > tc
> >
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php