Added a "name" field to the mailing list entries.
[cocanwiki.git] / scripts / mailing_list_send.ml
index 6fcbfcc..6fd1a19 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: mailing_list_send.ml,v 1.2 2004/09/24 16:45:02 rich Exp $
+ * $Id: mailing_list_send.ml,v 1.3 2004/09/24 17:11:57 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
@@ -33,6 +33,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
   let template = get_template dbh hostid "mailing_list_send.txt" in
 
   let email = trim (q#param "email") in
+  let name = trim (q#param "name") in
 
   if email = "" then (
     error ~title:"No email address" ~back_button:true
@@ -72,9 +73,10 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ =
   let opt_out = random_sessionid () in
 
   (* Insert into the database. *)
-  let sth = dbh#prepare_cached "insert into mailing_lists (hostid, email,
-                                  pending, opt_out) values (?, ?, ?, ?)" in
-  sth#execute [`Int hostid; `String email; `String pending; `String opt_out];
+  let sth = dbh#prepare_cached "insert into mailing_lists (hostid, email, name,
+                                  pending, opt_out) values (?, ?, ?, ?, ?)" in
+  sth#execute [`Int hostid; `String email; `String name;
+              `String pending; `String opt_out];
 
   dbh#commit ();