blob: 463b1b5e920bd0a5d28b5b308108e2a2b9a402dc (
plain)
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
58
59
60
|
<html>
<body bgcolor="white">
<head>
<title>Sessions Example</title>
</head>
<body>
<h3>Sessions Example</h3>
<?php
// print session info
$session = $request->session;
$created = new Java("java.util.Date", $session->creationTime);
$accessed = new Java("java.util.Date", $session->lastAccessedTime);
print "Session ID: $session->id<br>\n";
print "Created: " . $created->toString() . "<br>\n";
print "Last Accessed: " . $accessed->toString() . "<br>\n";
// set session info if needed
if ($dataName) $session->setAttribute($dataName, $dataValue);
// print session contents
print "<P>\n";
print "The following data is in your session:<br>\n";
$e = $session->attributeNames;
while ($e->hasMoreElements()) {
$name = $e->nextElement();
$value = $session->getAttribute($name);
print "$name = $value<br>\n";
}
?>
<P>
<form action="<?php echo $PHP_SELF ?>" method=POST>
Name of Session Attribute:
<input type=text size=20 name=dataName>
<br>
Value of Session Attribute:
<input type=text size=20 name=dataValue>
<br>
<input type=submit>
</form>
<P>GET based form:<br>
<form action="<?php echo $PHP_SELF ?>" method=GET>
Name of Session Attribute:
<input type=text size=20 name=dataName>
<br>
Value of Session Attribute:
<input type=text size=20 name=dataValue>
<br>
<input type=submit>
</form>
<p><a href="<?php echo $PHP_SELF ?>?dataName=foo&dataValue=bar" >URL encoded </a>
</body>
</html>
</body>
</html>
|