home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1999 April / CD_Shareware_Magazine_31.iso / WIN95 / INTERNET / h12395co.exe / data.1 / session.hei < prev    next >
Encoding:
Text File  |  1997-11-17  |  4.6 KB  |  153 lines

  1. //     Filename: session version 1.0
  2. // Release date: March 3rd, 1997
  3. //    File Type: heitml Component
  4. // 
  5. // (C) 1996-97 H.E.I. GmbH and suppliers all rights reseved
  6. // 
  7. // Redistribution and use in source and binary forms, with or without
  8. // modification, are permitted provided that the following conditions
  9. // are met:
  10. // 1. Redistributions of source code must retain the above copyright
  11. //    notice, this list of conditions and the following disclaimer.
  12. // 2. Redistributions in binary form must reproduce the above copyright
  13. //    notice, this list of conditions and the following disclaimer in the
  14. //    documentation and/or other materials provided with the distribution.
  15. // 3. Neither the name of H.E.I. GmbH nor the names of its contributors
  16. //    may be used to endorse or promote products derived from this software
  17. //    without specific prior written permission.
  18. // 4. The complete licensing conditions of heitml apply also to this file,
  19. //    be sure to have read and accepted these conditions before using this
  20. //    file. This file may be used and modified freely in conjunction with 
  21. //    a valid heitml license.
  22. // 
  23. // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  24. // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  25. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  26. // IN NO EVENT SHALL THE H.E.I. OR CONTRIBUTORS BE LIABLE FOR ANY
  27. // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  29. // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  31. // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  32. // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  33. // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34.  
  35. // This library is outdated. Please don't use unless for compatibility
  36. // purposes.
  37.  
  38.  
  39. <
  40.  
  41. def encodeurl t p="";
  42.    i=0; e="";
  43.    while (i<len(t));
  44.     if istuple(t[i]);
  45.        e=e+"&"+encodeurl(t[i],p=p+fname(t[i])+".");
  46.     else 
  47.        assign e; ?e >&< ?p; ?fname(t[i]) >=< ?t[i] furl; /assign
  48.     /if;
  49.     i=i+1;
  50.    /while
  51.    return substring(e,1,64000);
  52. /def
  53.  
  54.  
  55. def showtuple t;  
  56.    i=0>
  57.    <table border> <
  58.    while (i<len(t));
  59.     if istuple(t[i]);
  60.        showtuple t[i];
  61.     else >
  62.        <tr> <th> <?fname(t[i])> </th> <td> <?t[i]> </td> </tr>
  63.     </if
  64.     i=i+1;
  65.    /while>
  66.    </table>
  67. </def;
  68.  
  69.  
  70. defenv session mode="std"  start="/";
  71. //   ? isnull(ff.card);
  72.    if isnull(ff.card);
  73.     if mode!="ignore"; 
  74.        if mode!="create";
  75.           if mode!="failed">
  76.                  <html> <title> Permission Denyed </title> <body> 
  77.                    Sorry, this page can not be accessed directly,
  78.                    please check out the  <a href=<?start>> starting page </a>.
  79.              </body>
  80.           </if;
  81.               return;
  82.        /if;
  83.        ff.card = crypt(SrvTime+SrvIp);
  84.        dbupdate > 
  85.            insert into session (card, cdate, ctime, ip, udate, utime) values
  86.                (<? ff.card quoted>, <? SrvDate quoted>, <? SrvTime quoted>,
  87.                <? SrvIp quoted>, <? SrvDate quoted>, <? SrvTime quoted>)
  88.        < /dbupdate;
  89.         /if;
  90.     if isnull(gl.s); gl.s=emptytuple; /if;
  91.    else 
  92. //   ? ff.card;
  93.     dbquery q> select data from session  where card=<? ff.card quoted>
  94.     <dbrow;  gl.s=decodeurl (q.data);
  95. //    > Read <? q.data; 
  96.     dbempty; gl.s=emptytuple; > Empty <
  97.     /dbquery;
  98.    /if;
  99.    defbody;
  100.    x= encodeurl(gl.s);
  101. //   ? x;
  102.    if (contains(SrvDbsys,"YARD") || Contains(SrvDbSys,"ODBC"));
  103.       dbupdate >
  104.     update session set data = <? x hstv> 
  105.     where card=<? ff.card quoted>
  106.       </dbupdate;
  107.    else
  108.       dbupdate >
  109.     update session set data = <? x quoted> 
  110.     where card=<? ff.card quoted>
  111.       </dbupdate;
  112.    /if
  113. /defenv;
  114.  
  115.  
  116. defenv sa href par=null;
  117.    > <a href=<? href>?card=<? ff.card furl;
  118.    if !isnull(par)>&<?encodeurl(par) html> </if; 
  119.    >><defbody></a><
  120. /defenv
  121.  
  122. def sessionurl;
  123.    >card=<? ff.card><
  124. /def;
  125. def sessionhidden>
  126.    <input type=hidden name="card" value="<? ff.card html>">
  127. </def;
  128.  
  129. def sessioncreate;
  130. //    dbupdate> drop table session </dbupdate; 
  131.    if contains(SrvDbsys,"MSQL");
  132.       dbupdate> create table session (
  133.         card char(30),
  134.     cdate char(8),
  135.     ctime char(9),
  136.     ip    char(16),
  137.     udate char(8),
  138.     utime char(9),
  139.     data  char(3000))
  140.       </dbupdate;
  141.    else 
  142.       dbupdate> create table session (
  143.         card char(30),
  144.     cdate char(8),
  145.     ctime char(9),
  146.     ip    char(16),
  147.     udate char(8),
  148.     utime char(9),
  149.     data  text)
  150.       </dbupdate;
  151.    /if;
  152. /def>
  153.