Solved

Using cookies to verify username and password

Posted on 2003-12-01
5
260 Views
Last Modified: 2010-08-05
I am trying to verify username and password information.  The username and password is stored in a mysql database.  My login page uses the following form.  How can I use cookies to check if the user logged in with the correct username and password and be able to use that information to restrict users from getting to certain pages if they are not logged in.  Here is the form code I am using (I don't think the first line is right.  I want to go to ShopCart.html if the loggin information is correct.  If it is not correct, I want to alert the user and stay at the Login.html page.).

<FORM name="login"  action="ShopCart.html" method="post" language="javascript">
      <p> <b>Please Enter your username and password</b>
      <p>Username
        <input type="text" name="cname">
      <p>Password
        <input type="password" name="password2">
      <input type="SUBMIT" value="SUBMIT" name="LOGIN">
</FORM>

Thanks.
0
Comment
Question by:BobbyMc
5 Comments
 
LVL 51

Accepted Solution

by:
Ryan Chong earned 75 total points
ID: 9854664
0
 

Author Comment

by:BobbyMc
ID: 9863222
How would I incorporate the mysql part?  I need to get data from mysql to compare the login info to check to see if it is correct.
0
 
LVL 27

Expert Comment

by:rrz
ID: 9863291
If, you use a session then the container will take of  session id cookie,
then login page could create session bean to hold username and password information.  You could check that session bean  on each page or use a filter.  

You could also consider container managed security( search kennethxu's history for info).

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
J2SE 5.0 metadata 1 67
Retrieving file from bytes array in spring mvc 8 62
Market Place not working in Eclipse Luna 2 129
dao vs facade design patterns 2 29
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question