File: session.asp

package info (click to toggle)
libapache-asp-perl 2.63-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,120 kB
  • sloc: perl: 6,044; php: 409; sh: 62; lisp: 22; makefile: 10
file content (57 lines) | stat: -rwxr-xr-x 1,396 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl /usr/bin/asp-perl

<%
    my $form = $Request->Form();

# process form here
if($form->{increment}) {
    $Session->{Count}++;
} elsif($form->{timeout}) {
    $Session->Timeout(.25);
} elsif($form->{abandon}) {
    $Session->Abandon();
}

my @rows = (
	 '$Session->{Count}',
	 '$Session->{Timeout}',
	 '$Session->{SessionID}'
	 );
%>
<!--#include file=header.inc-->

This file demonstrates the use of the $Session object, as well
as one implementantion of cookieless sessions involving the 
use of the SessionQuery setting, and the <nobr>$Server->URL($url, \%params)</nobr>
method to add session ids to the form query string.
<p>
To demo the cookieless sessions, just turn off your cookies
and use this form.
<p>
<center>
<table border=1>
<tr><td colspan=2 align=center><b>Session Object Demonstration</b></td></tr>
<form action=<%=$Server->URL($demo->{file})%> method=POST>
<tr>
	<td colspan=2 align=center>
	<input type=submit name=increment value="Increment Count">
	<input type=submit name=timeout   value="Timeout 15 Seconds">
	<input type=submit name=abandon   value="Abandon">
	<td>
</tr>
</form>
<% for (@rows){ %>
	<tr>
		<td><tt><%=$Server->HTMLEncode($_)%></tt></td>		 
		<td><%=eval($_) || $@%></td>
	</tr>
<% } %>
</table>
</center>
<p>
The value for $Session->{Count} gets reset to 10 on every session start
in the global.asa file.

<!--#include file=footer.inc-->