home *** CD-ROM | disk | FTP | other *** search
- // Filename: session version 1.0
- // Release date: March 3rd, 1997
- // File Type: heitml Component
- //
- // (C) 1996-97 H.E.I. GmbH and suppliers all rights reseved
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions
- // are met:
- // 1. Redistributions of source code must retain the above copyright
- // notice, this list of conditions and the following disclaimer.
- // 2. Redistributions in binary form must reproduce the above copyright
- // notice, this list of conditions and the following disclaimer in the
- // documentation and/or other materials provided with the distribution.
- // 3. Neither the name of H.E.I. GmbH nor the names of its contributors
- // may be used to endorse or promote products derived from this software
- // without specific prior written permission.
- // 4. The complete licensing conditions of heitml apply also to this file,
- // be sure to have read and accepted these conditions before using this
- // file. This file may be used and modified freely in conjunction with
- // a valid heitml license.
- //
- // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- // IN NO EVENT SHALL THE H.E.I. OR CONTRIBUTORS BE LIABLE FOR ANY
- // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- // This library is outdated. Please don't use unless for compatibility
- // purposes.
-
-
- <
-
- def encodeurl t p="";
- i=0; e="";
- while (i<len(t));
- if istuple(t[i]);
- e=e+"&"+encodeurl(t[i],p=p+fname(t[i])+".");
- else
- assign e; ?e >&< ?p; ?fname(t[i]) >=< ?t[i] furl; /assign
- /if;
- i=i+1;
- /while
- return substring(e,1,64000);
- /def
-
-
- def showtuple t;
- i=0>
- <table border> <
- while (i<len(t));
- if istuple(t[i]);
- showtuple t[i];
- else >
- <tr> <th> <?fname(t[i])> </th> <td> <?t[i]> </td> </tr>
- </if
- i=i+1;
- /while>
- </table>
- </def;
-
-
- defenv session mode="std" start="/";
- // ? isnull(ff.card);
- if isnull(ff.card);
- if mode!="ignore";
- if mode!="create";
- if mode!="failed">
- <html> <title> Permission Denyed </title> <body>
- Sorry, this page can not be accessed directly,
- please check out the <a href=<?start>> starting page </a>.
- </body>
- </if;
- return;
- /if;
- ff.card = crypt(SrvTime+SrvIp);
- dbupdate >
- insert into session (card, cdate, ctime, ip, udate, utime) values
- (<? ff.card quoted>, <? SrvDate quoted>, <? SrvTime quoted>,
- <? SrvIp quoted>, <? SrvDate quoted>, <? SrvTime quoted>)
- < /dbupdate;
- /if;
- if isnull(gl.s); gl.s=emptytuple; /if;
- else
- // ? ff.card;
- dbquery q> select data from session where card=<? ff.card quoted>
- <dbrow; gl.s=decodeurl (q.data);
- // > Read <? q.data;
- dbempty; gl.s=emptytuple; > Empty <
- /dbquery;
- /if;
- defbody;
- x= encodeurl(gl.s);
- // ? x;
- if (contains(SrvDbsys,"YARD") || Contains(SrvDbSys,"ODBC"));
- dbupdate >
- update session set data = <? x hstv>
- where card=<? ff.card quoted>
- </dbupdate;
- else
- dbupdate >
- update session set data = <? x quoted>
- where card=<? ff.card quoted>
- </dbupdate;
- /if
- /defenv;
-
-
- defenv sa href par=null;
- > <a href=<? href>?card=<? ff.card furl;
- if !isnull(par)>&<?encodeurl(par) html> </if;
- >><defbody></a><
- /defenv
-
- def sessionurl;
- >card=<? ff.card><
- /def;
- def sessionhidden>
- <input type=hidden name="card" value="<? ff.card html>">
- </def;
-
- def sessioncreate;
- // dbupdate> drop table session </dbupdate;
- if contains(SrvDbsys,"MSQL");
- dbupdate> create table session (
- card char(30),
- cdate char(8),
- ctime char(9),
- ip char(16),
- udate char(8),
- utime char(9),
- data char(3000))
- </dbupdate;
- else
- dbupdate> create table session (
- card char(30),
- cdate char(8),
- ctime char(9),
- ip char(16),
- udate char(8),
- utime char(9),
- data text)
- </dbupdate;
- /if;
- /def>
-