Solved

Using cookies to verify username and password

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

15 Experts available now in Live!

Get 1:1 Help Now