add Ian's perl script for the java applet
authorminima <minima>
Thu, 14 Jun 2001 20:20:23 +0000 (20:20 +0000)
committerminima <minima>
Thu, 14 Jun 2001 20:20:23 +0000 (20:20 +0000)
Changes
spider-web/spider.cgi

diff --git a/Changes b/Changes
index 798a2909a2296cb7c129c3076086e7a952558d61..b878a70f47741b4ce2d917fe85150fb89710c345 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
 14Jun01=======================================================================
 1. changed debug api to (potentially) use less cpu time
+2. changed the spider.cgi in Arnold's borrowed java client to Ian's perl 
+script
 13Jun01=======================================================================
 1. fix init cnd rinit cmds
 2. add missing clear/route cmd
index b9b3a2595a488b37997c3029b5e4a9608dbe822d..8f104ce97d57e1117e1ab839c816a38b94d5e1c3 100755 (executable)
@@ -1,79 +1,91 @@
-#! /bin/sh
-#
-###################################################
-#
-# Edit the following lines
-#
-#
-portnumber=$"1407"
-tempdir=$"/usr/local/httpd/spider/client/"
-clustercall=$"PA4AB-15"
-#
-#
-#
-# End of configurable part
-#
-####################################################
-hostname=$"localhost"
-
-echo "Content-type: text/html"
-echo
-echo "<HTML><HEAD>"
-echo "<TITLE>Spider DX Cluster</TITLE>"
-echo "</HEAD><BODY>"
-echo '<BODY BGCOLOR="#d8d0c8">'
-echo "<PRE>"
-
-pattern=$(echo ${QUERY_STRING} | sed -e s,'call=',, | sed -e s/"&passwd="/" "/)
-call=$(echo $pattern | cut -d' ' -f1)
-passwd=$(echo $pattern | cut -s -d' ' -f2)
-
-
-if [ ${call} = ""]  ; then
-  echo "<BR>"
-  echo "<CENTER>"
-  echo "<STRONG><FONT SIZE=5>Welcome to the Spider DX Cluster</FONT></STRONG>"
-  echo "<STRONG><FONT SIZE=5>"
-  echo ${clustercall}
-  echo "</FONT></STRONG>"
-  echo "<P> &nbsp; </P>"
-  echo '<FORM action="/cgi-bin/spider.cgi" method=get>'
-  echo "<STRONG>Your Call Please: </STRONG> "
-  echo '<INPUT name="call" size=10> '
-  echo '<INPUT type=submit value="Click here to Login">'
-  echo "</CENTER>"
-  echo "<BR>"
+#!/usr/bin/perl
 
+# cluster-web.pl - perl login script for cluster web interface.
+# @author Ian Norton 
+# - Based on clx-web by DL6DBH (ftp://clx.muc.de/pub/clx/clx-java_10130001.tgz)
+# - Modified by PA4AB
+# @version 0.1 beta.  20010610.
+
+# Work out the hostname of this server.
+use Sys::Hostname;
+my $HOSTNAME = hostname();
+
+# Set the hostname manually here if the above fails.
+# $HOSTNAME = "gb7mbc.spoo.org" ;
+$PORT = "8000" ;
+
+# Send text/html header to the browser.
+print "Content-type: text/html\n\n";
+
+# Get the parameters passed to the script.
+read (STDIN, $post_data, $ENV{CONTENT_LENGTH});
+@call = split (/=/, $post_data) ;
+
+# Print the page header.
+
+print <<'EOF';
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML LANG="EN">
+    <HEAD>
+        <TITLE>Cluster Web - DX Cluster Web Interface.</TITLE>
+        <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=ISO-8859-1">
+        <META NAME="Author" CONTENT="Ian Norton.">
+        <META NAME="DESCRIPTION" CONTENT="DX Cluster web interface">
+    </HEAD>
+<BODY BGCOLOR="#FFFFFF" LINK="#008080" ALINK="#000099" VLINK="#000099">         
+
+    <H1>
+    <CENTER>
+        <FONT FACE="arial, helvicta" COLOR="#008080" SIZE=+2>
+        <B><BR>Cluster Web - DX Cluster Web Interface.</B><BR>
+EOF
+
+        print("Welcome to $HOSTNAME<BR>") ;
+
+print <<'EOF';
+        </FONT>
+    </CENTER>
+    </H1>
+
+<BR CLEAR="ALL">
+
+<HR>
+EOF
+
+if($ENV{CONTENT_LENGTH} > 0)
+    {
+    # Callsign is set - print the whole <APPLET> stuff....
+    # print("Callsign is $call[1]<BR>\n") ;
+
+    print("<CENTER>\n") ;
+    print("    <APPLET CODE=\"spiderclient.class\" CODEBASE=\"/client/\" width=800 height=130>\n") ;
+    print("        <PARAM NAME=\"CALL\" VALUE=\"$call[1]\">\n") ;
+    print("        <PARAM NAME=\"HOSTNAME\" VALUE=\"$HOSTNAME\">\n") ;
+    print("        <PARAM NAME=\"PORT\" VALUE=\"$PORT\">\n") ;
+    print("    </APPLET>\n") ;
+    print("</CENTER>\n") ;
+    }
 else
-  echo "<HTML>" > ${tempfile}${call}.html
-  echo "<HEAD>" >> ${tempfile}${call}.html
-  echo "</HEAD>" >> ${tempfile}${call}.html
-  echo "<BODY>" >> ${tempfile}${call}.html
-  echo '<APPLET code="spiderclient.class" width=800 height=130>'  >> ${tempdir}${call}.html
-  echo '<PARAM NAME="CALL" VALUE='  >> ${tempdir}${call}.html
-  echo ${call}  >> ${tempdir}${call}.html
-  echo ">" >> ${tempdir}${call}.html
-  echo ">"  >> ${tempdir}${call}.html 
-  echo '<PARAM NAME="HOSTNAME" VALUE="'  >> ${tempdir}${call}.html
-  echo ${hostname} >> ${tempdir}${call}.html
-  echo '">' >> ${tempdir}${call}.html
-  echo '<PARAM NAME="PORT" VALUE="'  >> ${tempdir}${call}.html
-  echo ${portnumber} >> ${tempdir}${call}.html
-  echo '">' >> ${tempdir}${call}.html
-  echo "</APPLET>"  >> ${tempdir}${call}.html
-  echo "</BODY>"  >> ${tempdir}${call}.html
-  echo "</HTML>"  >> ${tempdir}${call}.html
-  GOTO='<meta http-equiv="refresh"content="0;URL=http://'${hostname}'/client/'
-  GOTO=$GOTO$call.html
-  GOTO=$GOTO'">'
-  echo ${GOTO}
-
-fi
-  echo "</PRE>"
-  echo "</BODY></HTML>"
-
-#  all *.html tempory files remove older than 10 min 
-# 
-cd ${tempdir}
-files=$(find  *.html -mmin +10)
-rm ${files}
+    {
+    # Callsign isn't set - print the login page.
+    print <<'EOF';
+    <CENTER>
+    <FORM METHOD=POST>
+        <STRONG>Please enter your callsign: </STRONG><BR>
+        <INPUT name="call" size=10><BR>
+        <INPUT type=submit value="Click here to Login">
+    </FORM>
+    </CENTER>
+EOF
+    }
+
+print <<'EOF';
+<HR>
+
+<ADDRESS>
+<A HREF="http://www.dxcluster.org/">Spider Homepage</A>.
+</HTML>
+
+EOF