[an error occurred while processing this directive] CGI - A free tutorial for the Total Non-Programmer.
CGI - Let's get startedCGI - Introduction to Perl

Passwords


One of the interesting properties of CGI scripts is that, even though any user can execute them, there is no way to display them on the screen.  

e-mail me if you know differently. This means a password script can be as simple as this:

#********BEGIN BODY**************

if ($value[0] ne "mypassword") {
  print "Invalid Password";
} else {
print '

<BODY BGCOLOR="WHITE">

<H1> Welcome, you have entered the<P>
Password protected site </H1>

';
};

#*********END BODY***************

To use this script, you will need to create an HTML page with a form on it. If the password is the only box in the form, it will be passed to $value[0] when it runs this script.

Unlike JavaScript, the user cannot see this source code, so it is safe to use an IF statement at the top of the code.

if ($value[0] ne "mypassword") {

Print "Invalid Password"; } else { print '

<BODY BGCOLOR="WHITE">

<H1> Welcome, you have entered the<P>
Password protected site </H1>

';

 
BACKHTML Form | Guestbook Form | Hit Counters

Home | WebData - Web Database Software | Javascript | CGI | Consulting | Map Builder | Contact Us | The Press Room