~ubuntu-branches/ubuntu/trusty/ocamlnet/trusty

« back to all changes in this revision

Viewing changes to examples/cgi/netcgi1/cgi/counter.ml

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-09-02 14:12:33 UTC
  • mfrom: (18.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110902141233-zbj0ygxb92u6gy4z
Tags: 3.4-1
* New upstream release
  - add a new NetcgiRequire directive to ease dependency management
    (Closes: #637147)
  - remove patches that were applied upstream:
    + Added-missing-shebang-lines-in-example-shell-scripts
    + Try-also-ocamlc-for-POSIX-threads

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
(* $Id: counter.ml 1004 2006-09-25 16:01:06Z gerd $
2
 
 * ----------------------------------------------------------------------
3
 
 *
4
 
 *)
5
 
 
6
 
(***********************************************************************
7
 
 * This example demonstrates a very simple CGI page that contains
8
 
 * a counter that is incremented by the submit button.
9
 
 *
10
 
 * See add.ml for a slightly more complex example with more detailed
11
 
 * information.
12
 
 ***********************************************************************)
13
 
 
14
 
let cgi = new Netcgi.std_activation ()
15
 
let out = cgi # output # output_string
16
 
let n = cgi # argument_value ~default:"0" "Count"
17
 
;;
18
 
 
19
 
cgi # set_header ();
20
 
out "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"";
21
 
out " \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n";
22
 
out "<HTML>\n";
23
 
out "<HEAD>\n";
24
 
out "<TITLE>Counter</TITLE>\n";
25
 
out "</HEAD>\n";
26
 
out "<BODY>\n";
27
 
out "<H1>Counter</H1>\n";
28
 
out "<FORM ACTION=\"counter.cgi\" METHOD=\"GET\"";
29
 
out " ENCTYPE=\"application/x-www-form-urlencoded\">\n";
30
 
out "<INPUT TYPE=\"SUBMIT\" NAME=\"Count\" VALUE=\"";
31
 
out (string_of_int (int_of_string n + 1));
32
 
out "\">\n";
33
 
out "</FORM>\n";
34
 
out "</BODY>\n";
35
 
out "</HTML>\n";
36
 
 
37
 
(* ======================================================================
38
 
 * History:
39
 
 * 
40
 
 * $Log$
41
 
 * Revision 1.1  2001/10/19 05:32:42  pdoane
42
 
 * Moved to new example location
43
 
 *
44
 
 *)