X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Flogout.ml;h=0ec195212c8b8f68494866092017b37afd4e7e8e;hb=cd059731a60fd3d4dcf426430ad26ff227b91910;hp=e4827bca2ff2de777517c6cbe4dd1383131b8981;hpb=295f2cde3f43ccf7f775d39b95925e10aa4c37cb;p=cocanwiki.git diff --git a/scripts/logout.ml b/scripts/logout.ml index e4827bc..0ec1952 100644 --- a/scripts/logout.ml +++ b/scripts/logout.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: logout.ml,v 1.5 2005/03/31 14:24:04 rich Exp $ + * $Id: logout.ml,v 1.9 2006/03/28 16:24:07 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ open Cocanwiki_ok let expires = "Sun, 09-Sep-2001 02:46:40 GMT" -let run r (q : cgi) (dbh : Dbi.connection) _ _ user = +let run r (q : cgi) dbh hostid _ user = (* The logout function removes all of the associated cookies from the * database. This isn't required, but is nice semantics, and also helps * to reduce the size of the usercookies table in the database. @@ -37,17 +37,14 @@ let run r (q : cgi) (dbh : Dbi.connection) _ _ user = (match user with Anonymous -> () | User (userid, _, _, _) -> - let sth = dbh#prepare_cached "delete from usercookies - where userid = ?" in - sth#execute [`Int userid]; - - dbh#commit () + PGSQL(dbh) "delete from usercookies where userid = $userid"; + PGOCaml.commit dbh ); let cookie = Cookie.cookie "auth" "none" ~path:"/" ~expires in ok ~title:"Logged out" ~buttons:[ok_button "/"] ~cookie - q "You have been logged out." + dbh hostid q "You have been logged out." let () = register_script run