BobbyMc
asked on
Using cookies to verify username and password
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.
<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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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).
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).
ASKER