Solved

Using cookies to verify username and password

Posted on 2003-12-01
5
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 52

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 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