Solved

Using cookies to verify username and password

Posted on 2003-12-01
5
256 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 49

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
java.lang.UnsupportedClassVersionError 8 353
Set up Wildfly 10 8 325
console vs log file 16 76
sortaSum challenge java 17 171
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now