+fun readFile fname =
+ let
+ val inf = TextIO.openIn fname
+
+ fun readLines lines =
+ case TextIO.inputLine inf of
+ NONE => String.concat (List.rev lines)
+ | SOME line => readLines (line :: lines)
+ in
+ readLines []
+ before TextIO.closeIn inf
+ end
+
+fun readTosBody () = readFile "/home/hcoop/public_html/tos.body.html"
+fun readTosAgree () = readFile "/home/hcoop/public_html/tos.agree.html"
+fun readTosMinorAgree () = readFile "/home/hcoop/public_html/tos.agree.minor.html"
+
+fun searchPaypal paypal =
+ C.map (getDb ()) mkAppRow ($`SELECT id, name, rname, gname, email, forward, uses, other, passwd, status, applied, ipaddr, confirmed, decided,
+ msg, unix_passwd, paypal, checkout
+ FROM MemberApp
+ WHERE paypal = ^(C.stringToSql (normEmail paypal))
+ AND status = 2
+ AND decided >= CURRENT_TIMESTAMP - INTERVAL '1 MONTH'
+ ORDER BY applied`)
+
+fun searchCheckout checkout =
+ C.map (getDb ()) mkAppRow ($`SELECT id, name, rname, gname, email, forward, uses, other, passwd, status, applied, ipaddr, confirmed, decided,
+ msg, unix_passwd, paypal, checkout
+ FROM MemberApp
+ WHERE checkout = ^(C.stringToSql (normEmail checkout))
+ AND status = 2
+ AND decided >= CURRENT_TIMESTAMP - INTERVAL '1 MONTH'
+ ORDER BY applied`)
+
+end