comparison tests/cookieSec.ur @ 734:f2a2be93331c

Cookie signing working for forms
author Adam Chlipala <adamc@hcoop.net>
date Thu, 16 Apr 2009 19:12:12 -0400
parents
children
comparison
equal deleted inserted replaced
733:15ddd64a5113 734:f2a2be93331c
1 table t : {Id : int}
2
3 cookie c : int
4
5 fun setter r =
6 setCookie c (readError r.Id);
7 return <xml>Done</xml>
8
9 fun writer () =
10 ido <- getCookie c;
11 case ido of
12 None => error <xml>No cookie</xml>
13 | Some id => dml (INSERT INTO t (Id) VALUES ({[id]}));
14 return <xml>Done</xml>
15
16 fun main () = return <xml><body>
17 <form>
18 <textbox{#Id}/> <submit value="Get cookie" action={setter}/>
19 </form>
20
21 <form>
22 <submit value="Write to database" action={writer}/>
23 </form>
24 </body></xml>