X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fset_password_form.ml;h=99a309d64f1ca2c527351dd4755631e898917424;hb=cd059731a60fd3d4dcf426430ad26ff227b91910;hp=5f884b80d848430dac36365d8c2c93dde5fd7b34;hpb=867889b6d04b6381c74974e338672ee02d61920e;p=cocanwiki.git diff --git a/scripts/set_password_form.ml b/scripts/set_password_form.ml index 5f884b8..99a309d 100644 --- a/scripts/set_password_form.ml +++ b/scripts/set_password_form.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: set_password_form.ml,v 1.1 2004/09/21 13:01:16 rich Exp $ + * $Id: set_password_form.ml,v 1.3 2006/03/28 16:24:08 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 @@ -27,18 +27,18 @@ open Printf open Cocanwiki open Cocanwiki_template -let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = +let run r (q : cgi) dbh hostid _ _ = let template = get_template dbh hostid "set_password_form.html" in - let userid = int_of_string (q#param "userid") in + let userid = Int32.of_string (q#param "userid") in - let sth = dbh#prepare_cached "select name from users - where id = ? and hostid = ?" in - sth#execute [`Int userid; `Int hostid]; + let username = List.hd ( + PGSQL(dbh) + "select name from users + where id = $userid and hostid = $hostid" + ) in - let username = sth#fetch1string () in - - template#set "userid" (string_of_int userid); + template#set "userid" (Int32.to_string userid); template#set "username" username; q#template template