# | Line 1 | Line 1 | |
---|---|---|
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 | #-------------------------------------------------------------- | |
# | Line 19 | Line 19 | $| = 1; | |
19 | #-------------------------------------------------------------- | |
20 | # Essential Settings | |
21 | #-------------------------------------------------------------- | |
22 | < | my $build_dir = "/builds"; |
23 | < | my $log_file = "download_log"; |
22 | > | my ($build_dir) = "/builds"; |
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*$/); | |
# | Line 47 | Line 50 | 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 | < | 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"> |
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="600"> | |
94 | <tr> | |
95 | <td> | |
# | Line 102 | Line 136 | else { | |
136 | </html> | |
137 | EOT | |
138 | ||
139 | < | } |
139 | > | &print_html($bottom); |
140 | ||
141 | + | print <<"END"; |
142 | ||
143 | < | exit; |
143 | > | </td> |
144 | > | </tr> |
145 | > | </table> |
146 | > | |
147 | > | </body> |
148 | > | |
149 | > | </html> |
150 | > | END |
151 | > | |
152 | > | } |
153 | > | |
154 | > | exit; |
155 | > | |
156 | > | |
157 | > | # Print a file without escaping HTML: - |
158 | > | sub print_html ($) { |
159 | > | my ($filename) = @_; |
160 | > | print `cat $filename`; |
161 | > | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |