| 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.2 |
my ($build_dir) = "/builds"; |
| 23 |
|
|
my ($log_file) = "download_log"; |
| 24 |
pjm2 |
1.3 |
my ($left) = "../left.inc" ; |
| 25 |
|
|
my ($title) = "../title.inc"; |
| 26 |
|
|
my ($bottom) = "../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 |
|
|
print LOGFILE "$date|$file_name|$your_name|$email_address|$country\n"; |
| 52 |
|
|
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 |
|
|
<table align="center" width="600"> |
| 94 |
|
|
<tr> |
| 95 |
|
|
<td> |
| 96 |
|
|
<center><img src="/i-scream.gif" width="502" height="37" border="0"></center> |
| 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 |
| 100 |
|
|
of charge</b>. If you wish to be alerted infrequently about important issues |
| 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 |
|
|
</td> |
| 105 |
|
|
</tr> |
| 106 |
|
|
</table> |
| 107 |
|
|
|
| 108 |
|
|
<p> </p> |
| 109 |
|
|
|
| 110 |
|
|
<form action="download.cgi" method="POST"> |
| 111 |
|
|
<table border="0" align="center"> |
| 112 |
|
|
<tr> |
| 113 |
|
|
<td>Filename:</td> |
| 114 |
|
|
<td><b>$file_name</b><input type="hidden" name="file_name" value="$file_name"></td> |
| 115 |
|
|
</tr> |
| 116 |
|
|
<tr> |
| 117 |
|
|
<td>Your name:</td> |
| 118 |
|
|
<td><input type="text" name="your_name" value=""></td> |
| 119 |
|
|
</tr> |
| 120 |
|
|
<tr> |
| 121 |
|
|
<td>Email address:</td> |
| 122 |
|
|
<td><input type="text" name="email_address" value=""></td> |
| 123 |
|
|
</tr> |
| 124 |
|
|
<tr> |
| 125 |
|
|
<td>Country:</td> |
| 126 |
|
|
<td><input type="text" name="country" value=""></td> |
| 127 |
|
|
</tr> |
| 128 |
|
|
<tr> |
| 129 |
|
|
<td> </td> |
| 130 |
|
|
<td><input type="submit" name="submit" value="Download"></td> |
| 131 |
|
|
</tr> |
| 132 |
|
|
</table> |
| 133 |
|
|
</form> |
| 134 |
|
|
|
| 135 |
|
|
</body> |
| 136 |
|
|
</html> |
| 137 |
|
|
EOT |
| 138 |
|
|
|
| 139 |
pjm2 |
1.3 |
&print_html($bottom); |
| 140 |
|
|
|
| 141 |
|
|
print <<"END"; |
| 142 |
|
|
|
| 143 |
|
|
</td> |
| 144 |
|
|
</tr> |
| 145 |
|
|
</table> |
| 146 |
|
|
|
| 147 |
|
|
</body> |
| 148 |
|
|
|
| 149 |
|
|
</html> |
| 150 |
|
|
END |
| 151 |
|
|
|
| 152 |
pjm2 |
1.1 |
} |
| 153 |
|
|
|
| 154 |
pjm2 |
1.3 |
exit; |
| 155 |
|
|
|
| 156 |
pjm2 |
1.1 |
|
| 157 |
pjm2 |
1.3 |
# Print a file without escaping HTML: - |
| 158 |
|
|
sub print_html ($) { |
| 159 |
|
|
my ($filename) = @_; |
| 160 |
|
|
print `cat $filename`; |
| 161 |
|
|
} |