% response.buffer = true
'#################################################################################
'## Copyright (C) 2004 Rick Eastes
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License.
'##
'## The "powered by" text/logo with a link back to
'## http://www.nukedit.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'## Donations made to nukedit may waiver this requirement.
'## Speak to rick eastes via the nukedit contact form
'##
'## All copyright notices regarding nukedit
'## must remain intact in the scripts and in the outputted HTML
'##
'## Support can be obtained from support forums at:
'## http://www.nukedit.com/forum
'##
'## Bug fixed by René de Jong
'##
'## When loging out an error: "email.value is null or not an object" was displayed
'#################################################################################
response.Expires = -1 'FOR LOGIN CHANGES
%>
<%
on error goto 0
redirect = request("redirect")
message = request("message")
if not len(redirect) > 0 then
redirect = site & "default.asp"
end if
if(request("logout")="true")then
SetGuest
logout=true
response.Redirect "refresh.asp?redirect=login.asp"
end if
if(not CheckRegisteredUser OR request("logout")="true")then
email = replace(Replace(Request.form("email"),"'","''"),"""","")
'email = Request.form("email")
password = SHA256(Replace(Request.form("password"),"'","''"))
if(request("savepassword")="true")then
expireDate = date + CInt(request("duration"))
else
expireDate = date
end if
'strToday = year(date) & "-" & month(date) & "-" & day(date)
'message = "
Last Logged In: " & formatDate(Request.Cookies("lastlogin"))
'if(isnull(Session("dtLastLogin")) OR (Session("dtLastLogin") = "") OR (len(Session("dtLastLogin")) = 0)) then
' Session("lastlogin") = Request.Cookies("lastlogin")
'end if
if(len(email) > 0) then
set rsCheck = db.execute("select * from tblUsers where email = '" & email & "'")
if(not rsCheck.EOF) then
if (password=rsCheck("password")) then
set rsGroup = db.execute("select * from tblGroups where groupid = " & rsCheck("groupid"))
response.Cookies(setup_SiteCode & "password") = rsCheck("password")
Response.Cookies(setup_SiteCode & "groupid") = rsCheck("groupid")
Response.Cookies(setup_SiteCode & "userid") = rsCheck("userid")
response.Cookies(setup_SiteCode & "password").Expires = expireDate
Response.Cookies(setup_SiteCode & "groupid").Expires = expireDate
Response.Cookies(setup_SiteCode & "userid").Expires = expireDate
Session("email") = rsCheck("email")
Session("username") = rsCheck("username")
Session("userid") = rsCheck("userid")
Session("password") = rsCheck("password")
Session("groupid") = rsCheck("groupid")
Response.Redirect(site & "utilities/refresh.asp?redirect=" & redirect)
else
message = "
Incorrect Password"
end if
else
message = "
User not found"
end if
rsCheck.Close()
set rsCheck = nothing
else
SetGuest
end if
if(request("logout")="true")then
message="
You have been logged out."
end if
end if 'If RegisteredUser
response.buffer = true
WriteHeader "","" %>