LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 11-05-2007, 11:39 AM   #1
mobs99
Member
 
Registered: Oct 2007
Posts: 30

Rep: Reputation: 15
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

Last edited by mobs99; 11-05-2007 at 03:27 PM.
 
Old 11-05-2007, 05:33 PM   #2
mobs99
Member
 
Registered: Oct 2007
Posts: 30

Original Poster
Rep: Reputation: 15
so any1 have any ideas??
 
Old 11-05-2007, 05:40 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 11-06-2007, 02:39 PM   #4
mobs99
Member
 
Registered: Oct 2007
Posts: 30

Original Poster
Rep: Reputation: 15
ok i think
 
Old 11-07-2007, 12:54 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Start with this one: http://search.cpan.org/dist/CGI.pm/CGI.pm
 
Old 11-08-2007, 01:21 PM   #6
mobs99
Member
 
Registered: Oct 2007
Posts: 30

Original Poster
Rep: Reputation: 15
anyone have any more ideas.
would be greatly appreciated
 
Old 11-10-2007, 01:10 PM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Have you taken up any of the suggestions given so far? Where did they fall short?
--- rod.
 
Old 11-11-2007, 12:02 PM   #8
mobs99
Member
 
Registered: Oct 2007
Posts: 30

Original Poster
Rep: Reputation: 15
nope im completely confused...
ok ill start of with a index.pl file and home.pl and login/registration.pl
how do i get started
 
Old 11-12-2007, 10:15 PM   #9
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.

--- rod.

Last edited by theNbomr; 11-12-2007 at 10:16 PM.
 
Old 11-13-2007, 02:37 PM   #10
mobs99
Member
 
Registered: Oct 2007
Posts: 30

Original Poster
Rep: Reputation: 15
yeh ive done basic programs in html and perl...
this all needs to be done in perl and html....
 
Old 11-13-2007, 03:16 PM   #11
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 11-14-2007, 05:58 PM   #12
mobs99
Member
 
Registered: Oct 2007
Posts: 30

Original Poster
Rep: Reputation: 15
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???
 
Old 11-15-2007, 01:12 PM   #13
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 11-16-2007, 11:13 AM   #14
mobs99
Member
 
Registered: Oct 2007
Posts: 30

Original Poster
Rep: Reputation: 15
i understand what im suppose to do but how do i do it??? or get started
 
Old 11-16-2007, 12:16 PM   #15
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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 12:43 PM. Reason: Fix links
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl CGI:Can't locate CGI.pm supermyself Programming 13 09-10-2007 06:22 AM
Setting up a registration website jwolter0 Linux - Server 3 09-05-2007 05:21 AM
Perl CGI login authentication jefflanam Linux - Security 1 06-08-2007 02:06 AM
CGI/Perl indienick Programming 2 03-06-2006 03:16 PM
cgi perl : I cant get perl to append my html file... the_y_man Programming 3 03-22-2004 05:07 AM


All times are GMT -5. The time now is 08:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration