diff options
Diffstat (limited to 'tests/cookieSec.ur')
-rw-r--r-- | tests/cookieSec.ur | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/cookieSec.ur b/tests/cookieSec.ur new file mode 100644 index 00000000..ea5c9116 --- /dev/null +++ b/tests/cookieSec.ur @@ -0,0 +1,24 @@ +table t : {Id : int} + +cookie c : int + +fun setter r = + setCookie c (readError r.Id); + return <xml>Done</xml> + +fun writer () = + ido <- getCookie c; + case ido of + None => error <xml>No cookie</xml> + | Some id => dml (INSERT INTO t (Id) VALUES ({[id]})); + return <xml>Done</xml> + +fun main () = return <xml><body> + <form> + <textbox{#Id}/> <submit value="Get cookie" action={setter}/> + </form> + + <form> + <submit value="Write to database" action={writer}/> + </form> +</body></xml> |