View Full Version : Help in ASP Login...
PcMan
04-10-2005, 03:57 AM
Hay guy, this is my first day here... can someone please guide me somewhere where i can find the best ASP login and register thing for our site.
Thanks, PcMan
BigPete
04-11-2005, 01:51 PM
you should be able to find a few helpful solutions at http://www.aspin.com :cool:
ghell
04-11-2005, 02:24 PM
a login is a pretty easy but common script, a good way of doing this is this:<%If Request.Form = "" Then%>
<form method="post">
<input name="frmUserName" type="text">Username<br>
<input name="frmPassWord" type="text">Password<br>
<input type="submit" value="Log In">
</form>
<%
Else
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "..." 'your connectionstring goes here, try www.connectionstrings.com if you arent sure
Set rsLogin = objConn.Execute("SELECT ID FROM usertable WHERE usernamefield = '" & Request.Form("frmUserName") & "' AND passwordfield = '" & Request.Form("frmPassWord") & "'")
If NOT rsLogin.EOF Then
'process login
Response.Cookies("logincookieid") = rsLogin("ID")
Response.Cookies("logincookieid").Expires = Date() + 1
End If
objConn.Close
Set objConn = Nothing
Response.Redirect "pagebeforelogin.asp"
End If
%>this will check that their username and password combination exists in the database, and if it does it will set a cookie that will expire at midnight (server time)
this should be used with a page that check if there is an id in a cookie
if there is a cookie it shows them the logged in section for their id
if there is no cookie it runs this script so that they can create one
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.