add DXCIDR, fix version no tracking
[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.2 beta.  20020519.
8
9 # Work out the hostname of this server.
10 use Sys::Hostname;
11 my $HOSTNAME = hostname();
12
13 # Please note that the HOSTNAME MUST be resolvable from the user end. Otherwise the
14 # web interface will NOT work.
15 # Uncomment and set the hostname manually here if the above fails.
16 # $HOSTNAME = "gb7mbc.spoo.org" ;
17 $PORT = "8000" ;
18 $NODECALL = "XX0XX" ;
19
20 # Send text/html header to the browser.
21 print "Content-type: text/html\n\n";
22
23 # Get the parameters passed to the script.
24 read (STDIN, $post_data, $ENV{CONTENT_LENGTH});
25
26 $callstart = index($post_data, "=") + 1 ;
27 $callend = index($post_data, "&") ;
28
29 $call = substr($post_data, $callstart, $callend - $callstart), 
30 $password = substr($post_data, index($post_data, "=", $callend) + 1, length($post_data)) ;
31
32 # Print the page header.
33 #print("Callsign : $call") ;
34 #print("Password : $password") ;
35 print <<'EOF';
36
37 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
38 <HTML LANG="EN">
39     <HEAD>
40         <TITLE>Cluster Web - DX Cluster Web Interface.</TITLE>
41         <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=ISO-8859-1">
42         <META NAME="Author" CONTENT="Ian Norton.">
43         <META NAME="DESCRIPTION" CONTENT="DX Cluster web interface">
44     </HEAD>
45      
46 <BODY BGCOLOR="#FFFFFF" LINK="#008080" ALINK="#000099" VLINK="#000099">         
47
48     <H1>
49     <CENTER>
50         <FONT FACE="arial, helvicta" COLOR="#008080" SIZE=+2>
51         <B><BR>Cluster Web - DX Cluster Web Interface.</B><BR>
52 EOF
53
54         print("Welcome to $NODECALL<BR>") ;
55
56 print <<'EOF';
57         </FONT>
58     </CENTER>
59     </H1>
60
61 <BR CLEAR="ALL">
62
63 <HR>
64 EOF
65
66 if($ENV{CONTENT_LENGTH} > 0)
67     {
68     # Callsign is set - print the whole <APPLET> stuff....
69     # print("Callsign is $call<BR>\n") ;
70
71     print("<CENTER>\n") ;
72     print("    <APPLET CODE=\"spiderclient.class\" CODEBASE=\"/client/\" width=800 height=130>\n") ;
73     print("        <PARAM NAME=\"CALL\" VALUE=\"$call\">\n") ;
74     print("        <PARAM NAME=\"PASSWORD\" VALUE=\"$password\">\n") ;
75     print("        <PARAM NAME=\"HOSTNAME\" VALUE=\"$HOSTNAME\">\n") ;
76     print("        <PARAM NAME=\"PORT\" VALUE=\"$PORT\">\n") ;
77     print("        <PARAM NAME=\"NODECALL\" VALUE=\"$NODECALL\">\n") ;
78     print("    </APPLET>\n") ;
79     print("</CENTER>\n") ;
80     }
81 else
82     {
83     # Callsign isn't set - print the login page.
84     print <<'EOF';
85     <CENTER>
86     <FORM METHOD=POST>
87         <STRONG>Please enter your callsign: </STRONG><BR>
88         <INPUT name="call" size=10><BR>
89         <STRONG>Please enter your password: </STRONG><BR>
90         <INPUT name="password" size=10 TYPE=PASSWORD><BR>
91         <INPUT type=submit value="Click here to Login">
92     </FORM>
93     <BR>If you do not have a password set - don't enter one :)
94     </CENTER>
95 EOF
96     }
97
98 print <<'EOF';
99 <HR>
100
101 <ADDRESS>
102 <A HREF="http://www.dxcluster.org/">Spider Homepage</A>.
103 </HTML>
104
105 EOF