b9b3a2595a488b37997c3029b5e4a9608dbe822d
[spider.git] / spider-web / spider.cgi
1 #! /bin/sh
2 #
3 ###################################################
4 #
5 # Edit the following lines
6 #
7 #
8 portnumber=$"1407"
9 tempdir=$"/usr/local/httpd/spider/client/"
10 clustercall=$"PA4AB-15"
11 #
12 #
13 #
14 # End of configurable part
15 #
16 ####################################################
17 hostname=$"localhost"
18
19 echo "Content-type: text/html"
20 echo
21 echo "<HTML><HEAD>"
22 echo "<TITLE>Spider DX Cluster</TITLE>"
23 echo "</HEAD><BODY>"
24 echo '<BODY BGCOLOR="#d8d0c8">'
25 echo "<PRE>"
26
27 pattern=$(echo ${QUERY_STRING} | sed -e s,'call=',, | sed -e s/"&passwd="/" "/)
28 call=$(echo $pattern | cut -d' ' -f1)
29 passwd=$(echo $pattern | cut -s -d' ' -f2)
30
31
32 if [ ${call} = ""]  ; then
33   echo "<BR>"
34   echo "<CENTER>"
35   echo "<STRONG><FONT SIZE=5>Welcome to the Spider DX Cluster</FONT></STRONG>"
36   echo "<STRONG><FONT SIZE=5>"
37   echo ${clustercall}
38   echo "</FONT></STRONG>"
39   echo "<P> &nbsp; </P>"
40   echo '<FORM action="/cgi-bin/spider.cgi" method=get>'
41   echo "<STRONG>Your Call Please: </STRONG> "
42   echo '<INPUT name="call" size=10> '
43   echo '<INPUT type=submit value="Click here to Login">'
44   echo "</CENTER>"
45   echo "<BR>"
46
47 else
48   echo "<HTML>" > ${tempfile}${call}.html
49   echo "<HEAD>" >> ${tempfile}${call}.html
50   echo "</HEAD>" >> ${tempfile}${call}.html
51   echo "<BODY>" >> ${tempfile}${call}.html
52   echo '<APPLET code="spiderclient.class" width=800 height=130>'  >> ${tempdir}${call}.html
53   echo '<PARAM NAME="CALL" VALUE='  >> ${tempdir}${call}.html
54   echo ${call}  >> ${tempdir}${call}.html
55   echo ">" >> ${tempdir}${call}.html
56   echo ">"  >> ${tempdir}${call}.html 
57   echo '<PARAM NAME="HOSTNAME" VALUE="'  >> ${tempdir}${call}.html
58   echo ${hostname} >> ${tempdir}${call}.html
59   echo '">' >> ${tempdir}${call}.html
60   echo '<PARAM NAME="PORT" VALUE="'  >> ${tempdir}${call}.html
61   echo ${portnumber} >> ${tempdir}${call}.html
62   echo '">' >> ${tempdir}${call}.html
63   echo "</APPLET>"  >> ${tempdir}${call}.html
64   echo "</BODY>"  >> ${tempdir}${call}.html
65   echo "</HTML>"  >> ${tempdir}${call}.html
66   GOTO='<meta http-equiv="refresh"content="0;URL=http://'${hostname}'/client/'
67   GOTO=$GOTO$call.html
68   GOTO=$GOTO'">'
69   echo ${GOTO}
70
71 fi
72   echo "</PRE>"
73   echo "</BODY></HTML>"
74
75 #  all *.html tempory files remove older than 10 min 
76
77 cd ${tempdir}
78 files=$(find  *.html -mmin +10)
79 rm ${files}