2 cgitest.c - Testprogram for cgi.o
3 Copyright (c) 1998 Martin Schulze <joey@infodrom.north.de>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 * Compile with: cc -o cgitest cgitest.c -lcgi
32 printf ("<h1>Test-Form</h1>\n");
33 printf ("<form action=\"/cgi-bin/cgitest/insertdata\" method=post>\n");
34 printf ("Input: <input name=string size=50>\n<br>");
35 printf ("<select name=select multiple>\n<option>Nr. 1\n<option>Nr. 2\n<option>Nr. 3\n<option>Nr. 4\n</select>\n");
36 printf ("Text: <textarea name=text cols=50>\n</textarea>\n");
37 printf ("<center><input type=submit value=Submit> ");
38 printf ("<input type=reset value=Reset></center>\n");
44 printf ("<h1>Results</h1>\n\n");
45 printf ("<b>string</b>: %s<p>\n", cgiGetValue(cgi, "string"));
46 printf ("<b>text</b>: %s<p>\n", cgiGetValue(cgi, "text"));
47 printf ("<b>select</b>: %s<p>\n", cgiGetValue(cgi, "select"));
53 char *path_info = NULL;
58 path_info = getenv("PATH_INFO");
60 if (!strcmp(path_info, "/redirect")) {
61 cgiRedirect("http://www.infodrom.north.de/");
65 printf ("<html>\n<head><title>cgilib</title></title>\n\n<body>\n");
66 printf ("<h1>cgilib</h1>\n");
67 printf ("path_info: %s<br>\n", path_info);
68 if (!strcmp(path_info, "/insertdata")) {
75 printf ("<html>\n<head><title>cgilib</title></title>\n\n<body>\n");
76 printf ("<h1>cgilib</h1>\n");
80 printf ("\n<hr>\n</body>\n</html>\n");