%@ LANGUAGE="VBScript" %>
<% '***************************************************************************
'* ASP Football Pool *
'* *
'* Do not remove this notice. *
'* *
'* Copyright 1999-2003 by Mike Hall *
'* Please see http://www.brainjar.com for documentation and terms of use. *
'* *
'* Allows a user to login. *
'***************************************************************************
subTitle = "Login" %>
<% Response.Buffer = true %>
<% 'Open the database
call OpenDB()
'Get any form data.
username = Request("username")
password = Request("password")
if Request.ServerVariables("Content_Length") > 0 then
'Make sure cookies are enabled.
if Request.Cookies("FootballPoolTestCookie") = "" then
call ErrorMessage("You must use a browser that supports cookies and
" _
& "have them enabled in order to access this site.")
else
'Check input.
if username = "" then
call ErrorMessage("Please select a username.")
elseif password = "" then
call ErrorMessage("Please enter your password.")
else
'Verify the password and redirect to default page if correct.
sql = "select * from Users" _
& " where Username = '" & username & "'"
set rs = DbConn.Execute(sql)
if rs.EOF and rs.BOF then
call ErrorMessage("User '" & username & "' not found.")
elseif Hash(rs.Fields("Salt").Value & password) <> rs.Fields("Password").Value then
call ErrorMessage("Incorrect password, please reenter.")
else
Session("FootballPoolUsername") = rs.Fields("Username").Value
Response.Redirect("default.asp")
end if
end if
end if
else
'Set test cookie.
Response.Cookies("FootballPoolTestCookie") = "peanutbutter"
end if %>