Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting cookies

Status
Not open for further replies.

TonyU

Technical User
Feb 14, 2001
1,317
US
[tt]Can someone help me with setting up a cookie when the user logs in and checks the "remember me" checkbox?


I would like to set a username cookie but not sure how. Here's my form

***********************************************

<form action=&quot;<%=MM_LoginAction%>&quot;MM_valusername&quot;)&quot; name=&quot;form2&quot; onSubmit=&quot;MM_validateForm('login','','R','password','','R');return document.MM_returnValue&quot; method=&quot;post&quot;>
<DIV align=&quot;center&quot;>
<P>
<% if request(&quot;valid&quot;) = &quot;false&quot; then
response.write &quot;<font color=red>Login failed. Please try again or register to create your account.</font>&quot;
end if %>
</P>
</DIV>
<DIV align=&quot;center&quot;></DIV>
<table align=&quot;center&quot; class=&quot;mainparagraphs&quot; border=&quot;0&quot;>
<tr valign=&quot;baseline&quot; bgcolor=&quot;#3A6EA5&quot;>
<td nowrap align=&quot;right&quot; class=&quot;mainparagraphs&quot; colspan=&quot;2&quot;>
<DIV align=&quot;center&quot;><FONT color=&quot;#FFFFFF&quot;><B><FONT size=&quot;4&quot;>Log
In</FONT></B></FONT></DIV>
</td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot; class=&quot;mainparagraphs&quot;>Use Name:</td>
<td class=&quot;mainparagraphs&quot; valign=&quot;middle&quot;>
<DIV align=&quot;left&quot;>
<INPUT type=&quot;text&quot; name=&quot;login&quot; value=&quot;&quot; size=&quot;11&quot; maxlength=&quot;10&quot;>
</DIV>
</td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot; class=&quot;mainparagraphs&quot;>
<DIV align=&quot;right&quot; onSubmit=&quot;MM_validateForm('login','','R','password','','R');return document.MM_returnValue&quot;>Password:</DIV>
</td>
<td class=&quot;mainparagraphs&quot; valign=&quot;middle&quot;>
<DIV align=&quot;left&quot;>
<INPUT type=&quot;password&quot; name=&quot;password&quot; size=&quot;11&quot; value=&quot;&quot;>
</DIV>
</td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot; valign=&quot;middle&quot;>
<DIV align=&quot;center&quot;><FONT size=&quot;1&quot;><A href=&quot;#&quot; onClick=&quot;window.open('rememberme.asp','','toolbar=no,directories=no,status=no, scrollbars=yes, width=500,height=300')&quot;>remember
me</A></FONT></DIV>
</td>
<td>
<DIV align=&quot;left&quot;>
<INPUT type=&quot;checkbox&quot; name=&quot;check&quot;>
</DIV>
</td>
</tr>
<tr valign=&quot;baseline&quot; bgcolor=&quot;#3A6EA5&quot;>
<td nowrap align=&quot;right&quot; class=&quot;mainparagraphs&quot; colspan=&quot;2&quot; valign=&quot;middle&quot;>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;submit&quot; value=&quot;Log In&quot; name=&quot;submit&quot;>
</DIV>
</td>
</tr>
</table>
<P align=&quot;center&quot;> <OBJECT classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot; width=&quot;207&quot; height=&quot;26&quot;>
<PARAM name=movie value=&quot;button2.swf&quot;>
<PARAM name=quality value=high>
<PARAM name=&quot;BASE&quot; value=&quot;.&quot;>
<PARAM name=&quot;BGCOLOR&quot; value=&quot;&quot;>
<EMBED src=&quot;button2.swf&quot; base=&quot;.&quot; quality=high pluginspage=&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;207&quot; height=&quot;26&quot; bgcolor=&quot;&quot;>
</EMBED>
</OBJECT> </P>
</form>


***********************************************




[tt]&quot;A Successful man is one who can build a firm foundation with the bricks that others throw at him&quot;[/tt]
[noevil]
 
I got it.
[tt]&quot;A Successful man is one who can build a firm foundation with the bricks that others throw at him&quot;[/tt]
[noevil]
 
i don't see a &quot;remember me&quot; check box on your page, but rather a &quot;remember me&quot; link that calls up an asp page. assuming that the &quot;check&quot; check box fills that function and that you use an asp page to process the form data when it's submitted, the following should work from the asp page that processes the data...

Code:
<%
if request(&quot;check&quot;) = &quot;on&quot; then
  response.cookies(&quot;userID&quot;) = request(&quot;login&quot;)
end if
%>

glenn
 
[tt]Thanks gacaccia but I already figured it out. the checkbox is in green in my code.
[tt]&quot;A Successful man is one who can build a firm foundation with the bricks that others throw at him&quot;[/tt]
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top