ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/web/cgi-bin/download.cgi
Revision: 1.9.2.1
Committed: Sun May 11 19:52:45 2003 UTC (21 years ago) by tdb
Branch: I-SCREAM_ORG
Changes since 1.9: +3 -3 lines
Log Message:
Update for new webserver.

File Contents

# User Rev Content
1 pjm2 1.2 #!/usr/bin/perl
2 pjm2 1.1
3     #--------------------------------------------------------------
4     # download.cgi
5     #
6 pjm2 1.2 # A Perl CGI script that requests some details from the user
7     # before they download a build from the i-scream web site.
8     # To assist the paranoid, all fields are optional.
9 pjm2 1.1 #
10     # Copyright Paul Mutton, 2001.
11     #--------------------------------------------------------------
12    
13     use strict;
14     use CGI;
15    
16     $| = 1;
17    
18    
19     #--------------------------------------------------------------
20     # Essential Settings
21     #--------------------------------------------------------------
22 pjm2 1.8 my ($build_dir) = "/downloads";
23 pjm2 1.2 my ($log_file) = "download_log";
24 tdb 1.9.2.1 my ($left) = "../htdocs/left.inc" ;
25     my ($title) = "../htdocs/title.inc";
26     my ($bottom) = "../htdocs/bottom.inc";
27 pjm2 1.1 #--------------------------------------------------------------
28    
29    
30 pjm2 1.2 my ($query) = new CGI;
31 pjm2 1.1
32     my ($file_name) = ($query->param('file_name') =~ /^\s*(.*)\s*$/);
33     my ($your_name) = ($query->param('your_name') =~ /^\s*(.*)\s*$/);
34     my ($email_address) = ($query->param('email_address') =~ /^\s*(.*)\s*$/);
35     my ($country) = ($query->param('country') =~ /^\s*(.*)\s*$/);
36     my ($submit) = ($query->param('submit') =~ /^\s*(.*)\s*$/);
37     my ($date) = scalar localtime time;
38    
39     $your_name =~ s/\|//g;
40     $email_address =~ s/\|//g;
41     $country =~ s/\|//g;
42    
43     if (!defined($file_name) || $file_name eq "") {
44     print "Content-type: text/html\n\n";
45     print "You must specify a filename for use with the i-scream downloader.";
46     exit;
47     }
48    
49     if (defined($submit) && $submit eq "Download") {
50     open(LOGFILE, ">>$log_file");
51 pjm2 1.6 print LOGFILE "$date|$ENV{'REMOTE_ADDR'}|$file_name|$your_name|$email_address|$country\n";
52 pjm2 1.1 close(LOGFILE);
53 pjm2 1.2 print $query->redirect("$build_dir/$file_name");
54 pjm2 1.1 }
55     else {
56     print "Content-type: text/html\n\n";
57 pjm2 1.3
58     print <<"END";
59     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
60    
61     <!--
62     download.cgi
63     Created by pjm2 31/03/2001
64     Last modified 31/03/2001
65     -->
66    
67     <html>
68    
69     <head>
70     <title>i-scream downloads</title>
71     <meta name="description" content="The i-scream Project is a central monitoring system for Unix, Linux and NT servers.">
72     <meta name="keywords" content="i-scream, project, central monitoring system, unix, linux, nt, server, alert">
73     <meta name="generator" content="notepad on acid, aye.">
74     </head>
75    
76     <body bgcolor="#ffffff" link="#0000ff" alink="#3333cc" vlink="#3333cc" text="#000066">
77    
78     <table border="0" cellpadding="2" cellspacing="2">
79     <tr>
80     <td valign="top">
81     END
82    
83     &print_html($left);
84    
85     print <<"END";
86     </td>
87     <td valign="top">
88     END
89    
90     &print_html($title);
91    
92 pjm2 1.1 print <<EOT;
93 pjm2 1.4 <table align="center" width="500">
94 pjm2 1.1 <tr>
95     <td>
96 pjm2 1.4 <font face="arial,sans-serif">
97 pjm2 1.1 <center><h3>i-scream builds</h3></center>
98     <font size="2">
99 tdb 1.9 If you wish your details to be kept so we can contact you in the
100     future about i-scream, please enter them below. At the moment we
101     are not using this information, but we may collate a list of
102     details for when we make a new major release. All details are
103     optional - do not feel obliged to enter anything!
104 pjm2 1.1 </font>
105 pjm2 1.4 </font>
106 pjm2 1.1 </td>
107     </tr>
108     </table>
109    
110     <p>&nbsp;</p>
111    
112 pjm2 1.5 <form action="/cgi-bin/download.cgi" method="POST">
113 pjm2 1.1 <table border="0" align="center">
114     <tr>
115 pjm2 1.4 <td><font face="arial,sans-serif">Filename:</font></td>
116     <td><font face="arial,sans-serif"><b>$file_name</b></font><input type="hidden" name="file_name" value="$file_name"></td>
117 pjm2 1.1 </tr>
118     <tr>
119 pjm2 1.4 <td><font face="arial,sans-serif">Your name:</font></td>
120 pjm2 1.1 <td><input type="text" name="your_name" value=""></td>
121     </tr>
122     <tr>
123 pjm2 1.4 <td><font face="arial,sans-serif">Email address:</font></td>
124 pjm2 1.1 <td><input type="text" name="email_address" value=""></td>
125     </tr>
126     <tr>
127 pjm2 1.4 <td><font face="arial,sans-serif">Country:</font></td>
128 pjm2 1.1 <td><input type="text" name="country" value=""></td>
129     </tr>
130     <tr>
131     <td>&nbsp;</td>
132     <td><input type="submit" name="submit" value="Download"></td>
133     </tr>
134     </table>
135     </form>
136    
137     </body>
138     </html>
139     EOT
140    
141 pjm2 1.3 &print_html($bottom);
142    
143     print <<"END";
144    
145     </td>
146     </tr>
147     </table>
148     END
149    
150 pjm2 1.1 }
151    
152 pjm2 1.3 exit;
153    
154 pjm2 1.1
155 pjm2 1.3 # Print a file without escaping HTML: -
156     sub print_html ($) {
157     my ($filename) = @_;
158 tdb 1.7 print `cat $filename 2>&1`;
159 pjm2 1.6 }