Updated the Java Web Interface to allow passwords. If a user has no password
[spider.git] / spider-web / spider.cgi
1 #!/usr/bin/perl
2
3 # cluster-web.pl - perl login script for cluster web interface.
4 # @author Ian Norton 
5 # - Based on clx-web by DL6DBH (ftp://clx.muc.de/pub/clx/clx-java_10130001.tgz)
6 # - Modified by PA4AB
7 # @version 0.1 beta.  20010610.
8
9 # Work out the hostname of this server.
10 use Sys::Hostname;
11 my $HOSTNAME = hostname();
12
13 # Set the hostname manually here if the above fails.
14 # $HOSTNAME = "gb7mbc.spoo.org" ;
15 $PORT = "8000" ;
16
17 # Send text/html header to the browser.
18 print "Content-type: text/html\n\n";
19
20 # Get the parameters passed to the script.
21 read (STDIN, $post_data, $ENV{CONTENT_LENGTH});
22
23 $callstart = index($post_data, "=") + 1 ;
24 $callend = index($post_data, "&") ;
25
26 $call = substr($post_data, $callstart, $callend - $callstart), 
27 $password = substr($post_data, index($post_data, "=", $callend) + 1, length($post_data)) ;
28
29 # Print the page header.
30 #print("Callsign : $call") ;
31 #print("Password : $password") ;
32 print <<'EOF';
33
34 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
35 <HTML LANG="EN">
36     <HEAD>
37         <TITLE>Cluster Web - DX Cluster Web Interface.</TITLE>
38         <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=ISO-8859-1">
39         <META NAME="Author" CONTENT="Ian Norton.">
40         <META NAME="DESCRIPTION" CONTENT="DX Cluster web interface">
41     </HEAD>
42  
43 <BODY BGCOLOR="#FFFFFF" LINK="#008080" ALINK="#000099" VLINK="#000099">         
44
45     <H1>
46     <CENTER>
47         <FONT FACE="arial, helvicta" COLOR="#008080" SIZE=+2>
48         <B><BR>Cluster Web - DX Cluster Web Interface.</B><BR>
49 EOF
50
51         print("Welcome to $HOSTNAME<BR>") ;
52
53 print <<'EOF';
54         </FONT>
55     </CENTER>
56     </H1>
57
58 <BR CLEAR="ALL">
59
60 <HR>
61 EOF
62
63 if($ENV{CONTENT_LENGTH} > 0)
64     {
65     # Callsign is set - print the whole <APPLET> stuff....
66     # print("Callsign is $call<BR>\n") ;
67
68     print("<CENTER>\n") ;
69     print("    <APPLET CODE=\"spiderclient.class\" CODEBASE=\"/client/\" width=800 height=130>\n") ;
70     print("        <PARAM NAME=\"CALL\" VALUE=\"$call\">\n") ;
71     print("        <PARAM NAME=\"PASSWORD\" VALUE=\"$password\">\n") ;
72     print("        <PARAM NAME=\"HOSTNAME\" VALUE=\"$HOSTNAME\">\n") ;
73     print("        <PARAM NAME=\"PORT\" VALUE=\"$PORT\">\n") ;
74     print("    </APPLET>\n") ;
75     print("</CENTER>\n") ;
76     }
77 else
78     {
79     # Callsign isn't set - print the login page.
80     print <<'EOF';
81     <CENTER>
82     <FORM METHOD=POST>
83         <STRONG>Please enter your callsign: </STRONG><BR>
84         <INPUT name="call" size=10><BR>
85         <STRONG>Please enter your password: </STRONG><BR>
86         <INPUT name="password" size=10 TYPE=PASSWORD><BR>
87         <INPUT type=submit value="Click here to Login">
88     </FORM>
89     </CENTER>
90 EOF
91     }
92
93 print <<'EOF';
94 <HR>
95
96 <ADDRESS>
97 <A HREF="http://www.dxcluster.org/">Spider Homepage</A>.
98 </HTML>
99
100 EOF