self updates of HTML pages

I must allow people to update their own page with a few lines. I thing the easiest is to pasword protect a cgi which rebuilds the entire page with the entries. But I have not get time yet to really learn Perl.
Could someone help me in telling me what to do :
-  about the password
-  about the general structure (I fear wasting a few hours finding back the basics about file entry/reading as I have no perl book  in here).
Who is Participating?
TYoungConnect With a Mentor Commented:
Reading a file is very simple. First you need a file handle, usually a word that describes the file. Lets just say PAGE.

SO... we open the file, and give it the name PAGE.

open(PAGE, "/home/httpd/docs/users/myuser/index.html");

Simple. Then use an array variable to get the pages contents... like this:

@pagecontents = <PAGE>;

Again, Simple. Then close the file.


Now the @pagecontents contains the contents of the page you opened.

To write to the file, you have pretty much the same command, with one extra character:

open(PAGE, ">/home/httpd/docs/users/myuser/index.html");

The > says to open the page for output. So then to print to the page, use commands like this:

print PAGE "This is line 1\n";

or for using a lot of lines, do something like this:

print PAGE <<__STOP__;
<title>This is the title</title>
<font color="#62DA87">Hello</a>

That is useful so you don't have to put in \n's and backslashed before the quotes, etc.

------------------------ PASSWORDS ------------------------
Have a : delimited file with usernames and encrypted passwords. To encrypt the passwords, use the crypt function, and remember the SALT. Like this:

$password = crypt("AB", $FORM{'password'});

In that case, AB is the salt.
The file should look something like this:


Then read in the file, split the lines from the : and compare the login usernams and passwords to the ones in the file.

Note: To compare the passwords, encrypt the one they entered for the login, and see if it matched the one in the file.

Hope this helps.
toulonAuthor Commented:
Just something: how do I read online?
All Courses

From novice to tech pro — start learning today.