Contents of scripts/411.bas

1 rem Copyright (c) 1995 Novell, Inc.  All Rights Reserved.
10   rem
15   file$ = "scripts/employee.all"
20   if argc$ <> "0"  then 1000
30   print `Content-Type: text/html` : print
50   print `<HTML><HEAD><title>Search Employee Directory</title></HEAD>`
55   print "<BODY>"
60   print `<form action="/scripts/411.bas">`
65   print "The text file used for this sample is"
66   print "<I>", file$, "</I>.<P>"
70   print `Enter search string in lower case.  (If you're not sure, try <i>john</i>.)<p>`
75   print `<input type="text" name="who" maxlength="32"><p>`
80   print `<input type="submit">`
90   print `<input type="reset" value="Clear">`
100  print `</form>`
110  goto 5000
1000 ' if arguments, process the form
1001 open file$ for input as 1
1005 on error goto 4090
1020 sstring$ = form$(query_string$, "who")
1025 hits = 0
1030 print `Content-Type: text/html` : print
1035 print "<h1>Search result:</h1><hr>"
1040 while not eof(1)
1050   linput #1, line$
1060   if instr(sstring$, line$) < 1 then goto 1080
1065   print line$
1066   print "<hr>"
1070   hits = hits + 1
1080 wend
1090 close 1
1100 if hits = 0 then print "Sorry, nothing matches your request.<hr>"
1200 goto 5000
4090 print `Content-Type: text/html` : print
4095 print `error opening employee.all file`
5000 rem Standard trailer.  Note variable used to insert script name in hyperlink below.
5110 rem Hyperlink points to a BASIC script that displays raw HTML rather than translated HTML.
5130 print "<a href="; chr$(34); "/scripts/convert.bas?"; mid$(script_name$,2); chr$(34);" ><it>";
5140 print "See how this script is written.</it></a>"
5150 print "<p>"
5160 print "Copyright &#169; 1995 Novell, Inc.  All Rights Reserved."
5170 print "</body></HTML>"
5200 end