-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew.cpp
87 lines (76 loc) · 2.64 KB
/
new.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright (c) 1999 Peter Karlsson
//
// $Id$
//
// 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
// the Free Software Foundation, version 2
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <string>
#include <iostream.h>
#include <stdlib.h>
#include "config.h"
#include "getarg.h"
void display(string area);
// main
int main(void)
{
// Retrieve parameters
// new.exe?area=R20_INTRESSE
string area = getarg("area");
// Print the form
display(area);
return 1;
}
// display
// - print the message entry form
void display(string area)
{
// Check if we have a guest user
char *p = getenv("REMOTE_USER");
bool isguest = (strcmp(p, GUEST) == 0);
// HTTP preamble
cout << "Content-type: text/html" << endl;
cout << endl;
// HTML document
cout << "<html>" << endl;
cout << "<head>" << endl;
cout << " <title>Post to " << area << "</title>" << endl;
cout << " <meta name=\"generator\" content=\"new.exe\">" << endl;
cout << " <link rel=\"stylesheet\" href=\"fido.css\" type=\"text/css\">"
<< endl;
cout << "</head>" << endl;
cout << "<body>" << endl;
cout << "<h1>Post to " << area << "</h1>" << endl;
if (isguest)
{
cout << "You need an account to be allowed to post." << endl;
cout << "</body>" << endl;
cout << "</html>" << endl;
return;
}
cout << " <form action=\"reply.exe\" method=\"post\">" << endl;
cout << " <input type=\"hidden\" name=\"area\" value=\"" << area
<< "\">" << endl;
cout << " <input type=\"hidden\" name=\"name\" value=\"All\">" << endl;
cout << " Subject:<br>" << endl;
cout << " <input type=\"text\" name=\"subject\" value=\"\" "
"maxlen=75 size=75>" << endl;
cout << " <p>Message text:<br>" << endl;
cout << " <textarea name=\"body\" cols=80 rows=25 wrap=\"virtual\" "
"maxlength=32000></textarea>" << endl;
cout << " <br>" << endl;
cout << " <input type=\"submit\" value=\"Post message\">" << endl;
cout << " <input type=\"reset\" value=\"Reset\">" << endl;
cout << " </form>" << endl;
cout << "</body>" << endl;
cout << "</html>" << endl;
}