1 (* Easy Web Pages (EWP) scripts.
2 * Written by Richard W.M. Jones <rich@merjis.com>.
3 * Copyright (C) 2004 Merjis Ltd.
4 * $Id: logout.ml,v 1.1 2004/09/07 16:19:43 rich Exp $
15 let expires = "Sun, 09-Sep-2001 02:46:40 GMT"
17 let run r (q : cgi) (dbh : Dbi.connection) _ user =
18 (* The logout function removes all of the associated cookies from the
19 * database. This isn't required, but is nice semantics, and also helps
20 * to reduce the size of the usercookies table in the database.
24 | User (userid, _, _) ->
25 let sth = dbh#prepare_cached "delete from usercookies
27 sth#execute [`Int userid];
33 Cookie.cookie ~name:"auth" ~value:"none" ~path:"/" ~expires () in
35 ok ~title:"Logged out" ~buttons:[ok_button "/"] ~cookie
36 q "You have been logged out."