home *** CD-ROM | disk | FTP | other *** search
/ The HTML Web Publisher's Construction Kit / HTMLWPCK.ISO / unix / cgi / passwd.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1995-07-11  |  622 b   |  34 lines

  1. #!/bin/sh
  2. #this is a simple script demonstrating the location header and
  3. #a very crude password authentication.
  4.  
  5. PASSWORD=Schmoo
  6.  
  7. #replace the following path with the path of the file you
  8. #want to serve.
  9. PROTECTEDFILE=/usr/people/somedir/somepage.html
  10.  
  11. if [ $# = 0 ]
  12. then
  13.    cat << EOM
  14.     Content-Type: text/html
  15.  
  16.     <TITLE>Password example</TITLE>
  17.     <ISINDEX>
  18.     <H1>Protected page. Enter password</H!>
  19. EOM
  20. elif [ "$*" = "$PASSWORD" ] 
  21. then
  22.     echo Location: $PROTECTEDFILE
  23.     echo
  24. else
  25.     cat << EOM2
  26.         Content-Type: text/html
  27.  
  28.         <TITLE>Password example</TITLE>
  29.         <ISINDEX>
  30.         <H1>Password failed. Try again</H1>
  31. EOM2
  32. fi
  33.  
  34.