Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Create CGI login for webpage

by Biotachyonic (Initiate)
on Dec 20, 2005 at 14:03 UTC ( #518070=perlquestion: print w/replies, xml ) Need Help??

Biotachyonic has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I just put up a service that will allow Halo 2 players to find people who live in the same state and share the same zipcode. The most common request from users is that I allow them to register and manage their information. I would like to give each user a personal page that they can edit.

The only thing I have to work with is Perl. I'm not sure how I should go about setting this login process up and managing sessions, I've never done it before. This is my second CGI script.

Suggestions please?

The sie:

jdporter retitled from "Login". Also added p tags.

2005-12-20 Retitled by g0n, as per Monastery guidelines
Original title: 'Need suggestions for how to manage web logins and sessions'

Replies are listed 'Best First'.
Re: Create CGI login for webpage
by ptum (Priest) on Dec 20, 2005 at 14:37 UTC

    Greetings, Biotachyonic, and welcome to PerlMonks.

    • The only thing I have to work with is Perl.

    What more do you need? :)

    You may want to consider or the possibility of using cookies and a simple user lookup table for authentication. Some folks use .htaccess for this kind of thing.

    You'll stand a better chance of getting more substantive help if you narrow your question to a particular problem and post the relevant code. Good luck! :)

    No good deed goes unpunished. -- (attributed to) Oscar Wilde
Re: Create CGI login for webpage
by asz (Pilgrim) on Dec 20, 2005 at 20:42 UTC
Re: Create CGI login for webpage
by swkronenfeld (Hermit) on Dec 20, 2005 at 19:11 UTC
    This isn't the easiest project to learn Perl with, but it's a lot more exciting than making "Hello world!" programs. I myself learned Perl by making an online forum, complete with login and managing sessions through cookies. I'll give you a few pointers, and then if you have more questions, come back and post some specifics.

    • Read Ovid's CGI course - the entire thing. If you find yourself getting impatient with reading, then take what you learned to go code some, and then come back to the CGI course later and read some more.
    • An easy way to track a session is through a cookie. Cookies can be set through javascript, or through the page headers.
    • Start small and code modular. Start with a plain text delimited file for usernames and passwords, and write a subroutine that verifies a user's credentials as input. This is a great way to get logins working, and allows for easy debugging (if you need to check that a password for a new account is getting stores correctly, it's plain text in the file). Once everything is working correctly, you can worry about upgrading your security to the point at which you feel comfortable.

    Good luck, and have fun.

Re: Create CGI login for webpage
by matt.tovey (Beadle) on Dec 20, 2005 at 19:43 UTC
    Hi Biotachyonic,

    Your question sounds like someone in their first woodwork class who's been handed a log, been given access to every tool in the shop, and wants to build a cuckoo clock. :)

    OK, I'm exagerrating, but understand that Perl is a tool which will allow you to build absolutely anything you want, but that skill is required to produce beautiful results.

    You need to use Perl to build a CGI user database? The people here can definitely help you, but you're going to have to be prepared to do the programming yourself.

    Tutorials have been referenced - you need to read through these, try them out, and come back with specific questions on the parts where you would like clarification, or the parts where you get stuck in your programming.

    There are articles on perlmonks which describe the best way to ask a question, but they boil down to: a) have a definite question that you answered, b) demonstrate that you've attempted to solve the problem yourself before asking for help (e.g. supply parts of your code which don't quite work!).

    Welcome to perl CGI, where writing documents meets computer programming, and the skills learned in doing so can change a "user" into a "guru". ;)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://518070]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2022-05-19 05:12 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (71 votes). Check out past polls.