login/registration facility for website in perl/cgi
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
login/registration facility for website in perl/cgi
hello people
basically im trying to create a login/registration facility for a website where the following steps occur
where new visitors to the site can only register
returning visitors can only see a login facility
where if the above procedure goes wrong an error message comes up
or if its right then the 1st page of the site will appear
and if its a returning user there should be a tick box or something where there login details would be remembers for like an hour... so if they were to login within an hour the browser would remember...basically it will automatically redirect you to home page if logged in within same hour...
can someone help me because im a real novice but willing to learn...plz
It is very difficult to ascertain that a visitor is 'new' or 'returning'. Since the only identifying feature of a client connection may be the IP, you can only guess about whether the visitor is new. If the visitor supplies an identifying cookie, then you can know with some certainty that this is a returning visitor. IPs by themselves are not a reliable means of detecting returning visitors, since many IPs will be shared by numerous users.
I suggest you browse around on CPAN for packages that assist you in dealing with cookies and sessions.
--- rod.
Okay, perhaps I've overestimated where you are starting from. Have you done any CGI, PHP, or other server-side programming at all? If no, then you need to go to a basic tutorial on the subject, and start from there. A decent understanding of HTML and the fundamentals of web server operation would also be helpful.
Normally, you will be taking input from an HTML form, parsing its contents, and generating HTML code to proceed to the next step in the user's session. This idiom does not include any concept of sessions, and you usually need to contrive some method to do this. That method usually involves the use of cookies &/or hidden fields.
Please clarify what level of experience you presently have, and perhaps we can be more helpful.
Oky, you've done HTML & Perl, but have you done any server-side programming; i.e. CGI? Do you understand how the web server interacts with a CGI program? If yes, then the suggestions you've been given should be starting to make sense. Your question revolves around the overall concept of authentication, session management, and CGI in general.
Unless your 'audience' is very limited, you will probably not be able to do exactly what you want. If you log in to this forum from a new host or new browser, the forum will not identify you. Your problem is exactly the same.
--- rod.
yep thats correct rod lol i kno wot im supose to do and all that but i dont kno how to lol well no quite did abit today..
ive got the registration page done where the user registers and the details are stored in a text file.. no in my login page i need to read from this text file to check if the user has registerd but how do i do that???
You must use something that identifies the user. The login page will likely be a form, in which the user supplies some identifying token, usually what we call an ID, or account name, or user name and accompanied by a corresponding password. When submitted, your perl code will check the supplied user ID against the registration database/file. If the user is registered, you will probably proceed with the nuts & bolts of the web site, otherwise procede to the registration page. Your registration page may issue a cookie containing user ID info. When a user returns, your CGI script that creates the login form may use it to automatically fill in the user ID text entry widget, or simply accept the cookie as full authentication, bypassing the login process. This is where the CPAN modules to manage cookies may be helpful.
--- rod.
For starters:
Create 1 HTML page, a form that contains text entry widgets for user ID and password. You have said that you understand HTML, so this should not be a problem. I assume you have access to a web server for which you are able to create documents and CGI code.
Create 1 perl module as a CGI that reads and displays the received user ID and password. Use CGI.pm to FETCH THE VALUE OF A NAMED PARAMETER. Satisfy yourself that you are able to have a CGI script execute and extract data from a form.
If this isn't within your spectrum of understanding, then you need find a tutorial site that explains Perl in a CGI environment, and learn the basics of CGI programming. Actually, most tutorials will probably provide you with enough working code to accomplish the first steps in the process.
When you get the first script working, you will need to use the CGI.pm module to start generating HTML that composes the next page in your procedure, and probably working with COOKIES. Once you have accomplished this, you will probably be able to start seeing your own way.
When you come back here with specific questions, post some code fragments (use [C O D E] tags, please) that show where you are getting stuck. Please confirm that this is not a homework assignment.
--- rod.
Last edited by theNbomr; 11-16-2007 at 01:43 PM.
Reason: Fix links
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.