View Source

[examples]
context.wtcl
cookies.wtcl
cookiesIntro.wtcl
errors.wtcl
errorsIntro.wtcl
expr.wtcl
fish.jpg
fish.wtcl
flush.wtcl
flushIntro.wtcl
form.wtcl
formIntro.wtcl
index.wtcl
ready.wtcl
scripting.wtcl
scripting.wtcl~
scriptingIntro.wtcl
session.wtcl
sessionIntro.wtcl
uploads/
uploads.wtcl
uploadsIntro.wtcl
virtual.wtcl
virtualIntro.wtcl
File: / examples / session.wtcl

Lines Size Modified Created Owner MIME Types
125 2,536 2010/05/19 19:52:50 2011/06/13 15:35:16 BUILTIN\Administrators application/x-wtcl, text/x-wtcl

0001
<?
0002
0003
include ../lib/examplePage.wtcl
0004
0005
::wt::examples::setTitle "Session"
0006
0007
# This is the database session driver:
0008
0009
package require \
0010
  wt::session::dbSession::odbcSession::sqlServerSession
0011
0012
set action [params get action ""]
0013
0014
if {$action == "set"} {
0015
  # Set an entry
0016
  session set [params get name] [params get value]
0017
} elseif {$action == "del"} {
0018
  # Delete an entry
0019
  session remove [params get delName]
0020
}
0021
0022
# Session info
0023
0024
set props [concat [session properties] [session clientProperties]]
0025
set count [session count]
0026
0027
include ../lib/header.wtcl
0028
0029
?>
0030
0031
<h3>Session Information</h3>
0032
0033
<p>
0034
  <table cellpadding=0 cellspacing=0 border=0>
0035
0036
  <? foreach {k v} $props { ?>
0037
0038
    <tr valign=top>
0039
      <td style="padding: 3px 0px 3px 0px;"><b>[htmlEncode $k]</b> </td>
0040
      <td style="padding: 3px 0px 3px 3px;">[htmlEncode $v]</td>
0041
    </tr>
0042
0043
  <? } ?>
0044
0045
  </table>
0046
</p>
0047
0048
<h3>Session Entries</h3>
0049
0050
<? if {!$count} { ?>
0051
0052
<p>No items.</p>
0053
0054
<? } else { ?>
0055
0056
<p>
0057
<table cellpadding=3 cellspacing=1 bgcolor=#aaaaaa border=0 width=500>
0058
  <tr bgcolor=#eeeeee>
0059
    <td align=center style="padding: 3px;"><b>Name</b></td>
0060
    <td align=center style="padding: 3px;"><b>Value</b></td>
0061
  </tr>
0062
0063
  <? foreach {name value} [session items] { ?>
0064
0065
    <tr valign=top>
0066
      <td bgcolor=white style="padding: 3px;"><?= [htmlEncode $name] ?></td>
0067
      <td bgcolor=white style="padding: 3px;"><?= [htmlEncode $value] ?></td>
0068
    </tr>
0069
0070
  <? } ?>
0071
0072
</table>
0073
</p>
0074
0075
<? } ?>
0076
0077
<h3>Set Entry</h3>
0078
0079
<p>
0080
<form action="[selfUrl -html]" method=post>
0081
<table cellpadding=0 cellspacing=0 border=0>
0082
  <tr>
0083
    <td style="padding: 3px 0px 3px 0px;">
0084
      Name<br>
0085
      <input type=text name=name value=[htmlEncode [params get name ""]]><br>
0086
    </td>
0087
  </tr>
0088
  <tr>
0089
    <td style="padding: 3px 0px 3px 0px;">
0090
      Value<br>
0091
      <input type=text name=value value=[htmlEncode [params get value ""]]><br>
0092
    </td>
0093
  </tr>
0094
  <tr>
0095
    <td style="padding: 3px 0px 3px 0px;">
0096
      <input type=submit value=" OK ">
0097
    </td>
0098
  </tr>
0099
</table>
0100
<input type=hidden name=action value=set>
0101
</form>
0102
</p>
0103
0104
<h3>Delete Entry</h3>
0105
0106
<p>
0107
<form action="[selfUrl -html]" method=post>
0108
<table cellpadding=0 cellspacing=0 border=0>
0109
  <tr>
0110
    <td style="padding: 3px 0px 3px 0px;">
0111
      Name<br>
0112
      <input type=text name=delName value=[htmlEncode [params get delName ""]]><br>
0113
    </td>
0114
  </tr>
0115
  <tr>
0116
    <td style="padding: 3px 0px 3px 0px;">
0117
      <input type=submit value=" OK ">
0118
    </td>
0119
  </tr>
0120
</table>
0121
<input type=hidden name=action value=del>
0122
</form>
0123
</p>
0124
0125
<? include ../lib/footer.wtcl ?>