hi
this is a script i wrote for my application
enjoy
<%
loginCookie = request.cookies ("ltlsUser"
if loginCookie <> "" then ' ### checking if a cookie exsit ###''
response.redirect ("main.asp"
else
' ### start checking for user & password and write cookies ### '
if request("login"

<> "" then ' ### check if the user pressed the login button ###'
userName = request("user"

' ### get the userName from the form ###''
password = request("pass"

' ### get the password from the form ###''
' ### create recordset for check the user name ###'
set rsStudentCheck = server.CreateObject ("ADODB.Recordset"

sqlStudentCheck = "SELECT * FROM tblStudents WHERE (user='" & (userName) &"');"
rsStudentCheck.Open sqlStudentCheck, conn
' ### check password ###'
if rsStudentCheck.EOF then
response.write _
"<br><table class=tblEdit align=center>" &_
"<tr><td align=center>˘Ì†‰Ó˘˙Ó˘†˘‚ÂÈ<br><a href=index.asp>Ò‰†˘Â·</a></td></tr>" &_
"</table>"
else
if rsStudentCheck("password"

<> password then
response.write _
"<br><table class=tblEdit align=center>" &_
"<tr><td align=center>ÒÈÒÓ‡†˘‚Âȉ<br><a href=index.asp>Ò‰†˘Â·</a></td></tr>" &_
"</table>"
else
response.cookies ("ornmStdntUser"

= userName
response.cookies ("ornmStdntPass"

= password
response.cookies ("ornmStdntPass"

.expires = now() + 365
response.cookies ("ornmStdntUser"

.expires = now() + 365
response.redirect ("main.asp"
end if
end if
' ### end password check ###'
else
' ###login tables ###'
response.write _
"<br><table align=center border=1 bordercolor=black cellpadding=0 cellspacing=0 >" &_
"<tr align=center class=tblItem><td colspan=2><b><u>ÎÈÒ˙†ÁÈÍ</u></b></td></tr>" &_
"<form action=index.asp method=post>" &_
"<tr align=right class=tblTdBG><td> <b>˘Ì†Ó˘˙Ó˘</b><br></td><td><input type=text name=user size=20 maxlength=20></td></tr>" &_
"<tr align=right class=tblTdBG><td> <b>ÒÈÒÓ‡</b><br></td><td><input type=password name=pass size=20 maxlength=20></td></tr>" &_
"<tr align=center class=tblItem><td colspan=2><input type=submit class=submit name=login value=""ÎÈÒ‰ ÏÓÚ¯Î˙""></td></tr>" &_
"</form>" &_
"</table>" ' ### end login menu
end if
' ### end checking for user & password and write cookies ### '
end if
%> shai dayan