home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / asp / session.asp < prev    next >
Encoding:
Text File  |  2003-09-03  |  1.4 KB  |  58 lines

  1. #!/usr/bin/perl /usr/bin/asp-perl
  2.  
  3. <%
  4.     my $form = $Request->Form();
  5.  
  6. # process form here
  7. if($form->{increment}) {
  8.     $Session->{Count}++;
  9. } elsif($form->{timeout}) {
  10.     $Session->Timeout(.25);
  11. } elsif($form->{abandon}) {
  12.     $Session->Abandon();
  13. }
  14.  
  15. my @rows = (
  16.      '$Session->{Count}',
  17.      '$Session->{Timeout}',
  18.      '$Session->{SessionID}'
  19.      );
  20. %>
  21. <!--#include file=header.inc-->
  22.  
  23. This file demonstrates the use of the $Session object, as well
  24. as one implementantion of cookieless sessions involving the 
  25. use of the SessionQuery setting, and the <nobr>$Server->URL($url, \%params)</nobr>
  26. method to add session ids to the form query string.
  27. <p>
  28. To demo the cookieless sessions, just turn off your cookies
  29. and use this form.
  30. <p>
  31. <center>
  32. <table border=1>
  33. <tr><td colspan=2 align=center><b>Session Object Demonstration</b></td></tr>
  34. <form action=<%=$Server->URL($demo->{file})%> method=POST>
  35. <tr>
  36.     <td colspan=2 align=center>
  37.     <input type=submit name=increment value="Increment Count">
  38.     <input type=submit name=timeout   value="Timeout 15 Seconds">
  39.     <input type=submit name=abandon   value="Abandon">
  40.     <td>
  41. </tr>
  42. </form>
  43. <% for (@rows){ %>
  44.     <tr>
  45.         <td><tt><%=$Server->HTMLEncode($_)%></tt></td>         
  46.         <td><%=eval($_) || $@%></td>
  47.     </tr>
  48. <% } %>
  49. </table>
  50. </center>
  51. <p>
  52. The value for $Session->{Count} gets reset to 10 on every session start
  53. in the global.asa file.
  54.  
  55. <!--#include file=footer.inc-->
  56.  
  57.  
  58.