Gossamer Forum
Home : General : Perl Programming :

Add a login / password feature to an existing cgi script

Quote Reply
Add a login / password feature to an existing cgi script
Hello,

I have a script that displays the entries of a database.

Now, I would like to add a login / password feature on the top of that script so only people with a valid login / password are allowed to view the database.

I would like to add this feature directly in the cgi to make sure that everybody log on first, even if they bookmark the URL.

I can't use .htaccess.

I noticed that DBMan is using this kind a feature.

Could someone help me with this ?

Thanks a lot.
Quote Reply
Re: [Lotz] Add a login / password feature to an existing cgi script In reply to
Its not really something that can be easily explained, especially without seeing the code.

Basically you have to direct people to the login page and force them to login. You need to check their username/password against a database - flatfile or sql. Then either create a session file/record or use an encrypted cookie and check for that before allowing access.
Quote Reply
Re: [Paul] Add a login / password feature to an existing cgi script In reply to
For the beginning, I just need something very basic and that doesn't need to be very secured.

The password doesn't need to be encrypted and could even be in the cgi itself, don’t need to have a database for login and password. Only one password and login is ok.

I found some password scripts like that, but all those scripts redirect the user with a valid username and password to a new URL.

I would like to do the same, but instead of having the script redirect to a new page, I would like that it goes to the step 2.

For example, on the cgi, the first step would be to display a login / password form, check if the entries are correct and then step 2 would be to display the results of the database.

It wouldn't be possible to go to step 2 if step 1 has not been passed successively.
Quote Reply
Re: [Lotz] Add a login / password feature to an existing cgi script In reply to
Still need password/login added to script, I can do it, cookie based!!
Quote Reply
Re: [Stefko] Add a login / password feature to an existing cgi script In reply to
Hello,

Yes, I'm still looking for this feature.

Now I'm using 2 scripts, one for the login - password - redirection and the other to display the database.

The person who has access to the database once can bookmark it and go there without password, that's why I would like to have everything in the same script.

Thanks.
Quote Reply
Re: [Lotz] Add a login / password feature to an existing cgi script In reply to
E-mail me the pl file, just the database pl program, and I'll include a "VERY SIMPLE" login which uses cookies to allow user to access program until all browsers are closed!