<%
'Create DSN Less connection to Access Database
'Create DBConnection Object
Set DBConnection = Server.CreateObject("adodb.connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.Mappath("/Pathtoyourdatabase.mdb")
DBConnection.Open DSN
UserID = Request.Cookies("Forum")("UID")
last = Request.Cookies("FLVST")("LTVST")
SQL = "Select * From tblAuthor Where User_code = '"& UserID &"'"
Set RS = DBConnection.Execute(SQL)
Select Case RS.eof
Case False
tempRSCount = RS.getrows
Set RS = Nothing
logon = Cdbl(UBound(tempRSCount, 2)) + 1
Case True
logon = "0"
End Select
Set RS = Nothing
IF logon = "0" Then
%>
<form method="POST" action="/forum/login_user.asp<% = strReturnPageProperties %>">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
<tr>
<td width="50%">
<p align="right"><font face="Verdana" size="1">Username</font>: </td>
<td width="50%"><input type="text" name="name" size="11"></td>
</tr>
<tr>
<td width="50%">
<p align="right"><font face="Verdana" size="1">Password</font>: </td>
<td width="50%"><input type="password" name="password" size="11"></td>
</tr>
<tr>
<td width="100%" colspan="2"> </td>
</tr>
<tr>
<td width="100%" colspan="2">
<input type="hidden" name="sessionID" value="<% = Session.SessionID %>" />
<p align="center"><input type="submit" name="Submit" value="<% = strTxtLoginUser %>"></td>
</tr>
</table>
<p align="center">
<font size="1" face="Verdana">Don't have an account?</font>
<BR>
<font face="Verdana" size="2"><a href="/forum/register_form.asp">Register here </a>
</font>
</p>
<input type="hidden" name="AutoLogin" value="True">
<input type="hidden" name="ActiveUsers" value="True">
</form>
<%
Else
'If user allready loged in don't show login screen
'You can show somthing else insted like maybe last time visited or somthing
End IF
%>
This is how I do it. It works well.
Edited by vdub