1 |
< |
#!/usr/bin/perl -w |
1 |
> |
#!/usr/bin/perl |
2 |
|
|
3 |
|
#-------------------------------------------------------------- |
4 |
|
# download.cgi |
5 |
|
# |
6 |
< |
# A Perl CGI script that requests a user's email address |
7 |
< |
# before they may download a build from the i-scream web site. |
8 |
< |
# It is not essential for them to enter their email address. |
6 |
> |
# 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 |
|
# |
10 |
|
# Copyright Paul Mutton, 2001. |
11 |
|
#-------------------------------------------------------------- |
19 |
|
#-------------------------------------------------------------- |
20 |
|
# Essential Settings |
21 |
|
#-------------------------------------------------------------- |
22 |
< |
my $build_dir = "/builds"; |
23 |
< |
my $log_file = "download_log"; |
22 |
> |
my ($build_dir) = "/downloads"; |
23 |
> |
my ($log_file) = "download_log"; |
24 |
> |
my ($left) = "../left.inc" ; |
25 |
> |
my ($title) = "../title.inc"; |
26 |
> |
my ($bottom) = "../bottom.inc"; |
27 |
|
#-------------------------------------------------------------- |
28 |
|
|
29 |
|
|
30 |
< |
my $query = new CGI; |
30 |
> |
my ($query) = new CGI; |
31 |
|
|
32 |
|
my ($file_name) = ($query->param('file_name') =~ /^\s*(.*)\s*$/); |
33 |
|
my ($your_name) = ($query->param('your_name') =~ /^\s*(.*)\s*$/); |
48 |
|
|
49 |
|
if (defined($submit) && $submit eq "Download") { |
50 |
|
open(LOGFILE, ">>$log_file"); |
51 |
< |
print LOGFILE "$date|$file_name|$your_name|$email_address|$country\n"; |
51 |
> |
print LOGFILE "$date|$ENV{'REMOTE_ADDR'}|$file_name|$your_name|$email_address|$country\n"; |
52 |
|
close(LOGFILE); |
53 |
< |
print "Location: $build_dir/$file_name\n\n"; |
53 |
> |
print $query->redirect("$build_dir/$file_name"); |
54 |
|
} |
55 |
|
else { |
56 |
|
print "Content-type: text/html\n\n"; |
57 |
< |
|
58 |
< |
print <<EOT; |
57 |
> |
|
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 |
< |
<basefont face="arial,sans-serif" size="2"> |
69 |
< |
<body bgcolor="white" text="#000066"> |
70 |
< |
<table align="center" width="600"> |
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 |
+ |
print <<EOT; |
93 |
+ |
<table align="center" width="500"> |
94 |
+ |
<tr> |
95 |
|
<td> |
96 |
< |
<center><img src="/i-scream.gif" width="502" height="37" border="0"></center> |
96 |
> |
<font face="arial,sans-serif"> |
97 |
|
<center><h3>i-scream builds</h3></center> |
98 |
|
<font size="2"> |
99 |
|
At the current moment, all i-scream builds may be downloaded <b>free |
101 |
|
regarding the i-scream montoring system, then we would recommend that |
102 |
|
you provide your contact details below. All fields are optional. |
103 |
|
</font> |
104 |
+ |
</font> |
105 |
|
</td> |
106 |
|
</tr> |
107 |
|
</table> |
108 |
|
|
109 |
|
<p> </p> |
110 |
|
|
111 |
< |
<form action="download.cgi" method="POST"> |
111 |
> |
<form action="/cgi-bin/download.cgi" method="POST"> |
112 |
|
<table border="0" align="center"> |
113 |
|
<tr> |
114 |
< |
<td>Filename:</td> |
115 |
< |
<td><b>$file_name</b><input type="hidden" name="file_name" value="$file_name"></td> |
114 |
> |
<td><font face="arial,sans-serif">Filename:</font></td> |
115 |
> |
<td><font face="arial,sans-serif"><b>$file_name</b></font><input type="hidden" name="file_name" value="$file_name"></td> |
116 |
|
</tr> |
117 |
|
<tr> |
118 |
< |
<td>Your name:</td> |
118 |
> |
<td><font face="arial,sans-serif">Your name:</font></td> |
119 |
|
<td><input type="text" name="your_name" value=""></td> |
120 |
|
</tr> |
121 |
|
<tr> |
122 |
< |
<td>Email address:</td> |
122 |
> |
<td><font face="arial,sans-serif">Email address:</font></td> |
123 |
|
<td><input type="text" name="email_address" value=""></td> |
124 |
|
</tr> |
125 |
|
<tr> |
126 |
< |
<td>Country:</td> |
126 |
> |
<td><font face="arial,sans-serif">Country:</font></td> |
127 |
|
<td><input type="text" name="country" value=""></td> |
128 |
|
</tr> |
129 |
|
<tr> |
137 |
|
</html> |
138 |
|
EOT |
139 |
|
|
140 |
< |
} |
140 |
> |
&print_html($bottom); |
141 |
|
|
142 |
+ |
print <<"END"; |
143 |
|
|
144 |
< |
exit; |
144 |
> |
</td> |
145 |
> |
</tr> |
146 |
> |
</table> |
147 |
> |
END |
148 |
> |
|
149 |
> |
} |
150 |
> |
|
151 |
> |
exit; |
152 |
> |
|
153 |
> |
|
154 |
> |
# Print a file without escaping HTML: - |
155 |
> |
sub print_html ($) { |
156 |
> |
my ($filename) = @_; |
157 |
> |
print `cat $filename 2>&1`; |
158 |
> |
} |