|
<% @ Language=VBScript %> <!--#include file="common.asp" --> <!--#include file="functions/functions_hash1way.asp" --> <!--#include file="functions/functions_filters.asp" -->
<%
strDatabaseDateFunction = "Now()"
Set adoCon = Server.CreateObject("ADODB.Connection") strDbPathAndName = Server.MapPath("admin/database/login.mdb") strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strDbPathAndName adoCon.connectionstring = strCon adoCon.Open
query = "SELECT TOP 10 * FROM tblAuthor"
Set rsLogin = Server.CreateObject("ADODB.Recordset") rsLogin.CursorType = 0 rsLogin.CursorLocation = 2 rsLogin.LockType = 1 rsLogin.Open query, adoCon
%>
<%
'****************************************** '*** Create Usercode ***** '******************************************
Private Function userCode(ByVal strUsername)
'Randomise the system timer Randomize Timer
'Calculate a code for the user strUserCode = strUsername & hexValue(15)
'Make the usercode SQL safe strUserCode = formatSQLInput(strUserCode)
'Replace double quote with single in this intance strUserCode = Replace(strUserCode, "''", "'", 1, -1, 1)
'Return the function userCode = strUserCode End Function
%> <style type="text/css"> <!-- .style8 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 10px; } .style10 {font-family: Arial, Helvetica, sans-serif; font-size: 10px; } --> </style>
<table border=1 width=50%> <tr align="center"> <td> <span class="style8">Username </span></td> <td> <span class="style8">Usercode </span></td> <td> <span class="style8">Password </span></td> <td> <span class="style8">prev. Password </span> </td> <td> <span class="style8">Salt </span></td> </tr>
<% while not rsLogin.eof %>
<%
Dim strUsername Dim strPassword Dim strSalt
strUsername = rsLogin("Username") strPassword = rsLogin("Password") 'strSalt = rsLogin("Salt")
'****************************************** '*** Create a usercode *** '******************************************
'Calculate a code for the user strUserCode = userCode(strUsername)
'****************************************** '*** Encrypt password *** '******************************************
strSalt = getSalt(Len(strPassword))
'Concatenate salt value to the password strEncryptedPassword = strPassword & strSalt
'Encrypt the password strEncryptedPassword = HashEncode(strEncryptedPassword)
'****************************************** '*** Create usercode cookie *** '****************************************** 'Write the cookie with the name Forum containing the value UserID number Response.Cookies(strCookieName)("UID") = strUserCode
'Set the expiry date for 1 year (365 days) 'If no expiry date is set the cookie is deleted from the users system 20 minutes after they leave the forum Response.Cookies(strCookieName).Expires = Now() + 365
%>
<tr> <td> <span class="style10"><%= rsLogin("Username")%> </span></td> <td> <span class="style10"><%= strUserCode %> </span></td> <td> <span class="style10"><%= strEncryptedPassword %> </span></td> <td> <span class="style8"><%= rsLogin("Password")%> </span> </td> <td> <span class="style10"><%= strSalt %> </span></td> </tr> <% rsLogin.movenext wend%>
</table>
<% rsLogin.Close Set rsLogin = Nothing adoCon.Close Set adoCon = Nothing %>
|