Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 locking members, login.asp
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

goju
New Member

Canada
67 Posts

Posted - 11 November 2002 :  17:29:22  Show Profile  Visit goju's Homepage
when you lock out a member and they try to login, all it says is that their password or username is inncorrect.
If you're locking their account because they haven't been on in awhile (especially if they dont really check their email), they usually just think they've forgotten their password and try to change it or re-register.
Is there an easy way to include a message on login.asp to let them know of their current situation??

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 11 November 2002 :  19:55:05  Show Profile
It requires a small change to the chkUser function, and then some additional code in both the inc_header.asp and login.asp files. If you want to e-mail me your inc_header.asp, login.asp & inc_func_common.asp files, I'll make the changes for you.

you can e-mail them to here: richard_kinser@yahoo.com

please put the 3 files in a .zip file first.
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 11 November 2002 :  20:09:19  Show Profile
here are the changes I made:

in inc_func_common.asp replace the chkUser function with this one:

function chkUser(fName, fPassword, fAuthor)
 
	dim rsCheck
	dim strSql
 
	'## Forum_SQL
	strSql = "SELECT MEMBER_ID, M_STATUS, M_LEVEL, M_NAME, M_PASSWORD "
	strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
	strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(fName, "SQLString") & "' "
	if strAuthType="db" then	
		strSql = strSql & " AND M_PASSWORD = '" & ChkString(fPassword, "SQLString") &"'"
	End If
	'strSql = strSql & " AND M_STATUS = " & 1
	Set rsCheck = my_Conn.Execute(strSql)
	if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then
		MemberID = -1
		chkUser = 0 '##  Invalid Password
		if strDBNTUserName <> "" and chkCookie = 1 then
			Call ClearCookies()
			strDBNTUserName = ""
		end if		
	else
		if rsCheck("M_STATUS") = 1 then
			MemberID = rsCheck("MEMBER_ID")
			if (rsCheck("MEMBER_ID") & "" = fAuthor & "") and (cLng(rsCheck("M_LEVEL")) <> 3) then 
				chkUser = 1 '## Author
			else
				select case cLng(rsCheck("M_LEVEL"))
					case 1
						chkUser = 2 '## Normal User
					case 2
						chkUser = 3 '## Moderator
					case 3
						chkUser = 4 '## Admin
					case else
						chkUser = cLng(rsCheck("M_LEVEL"))
				end select
			end if
		else
			MemberID = -1
			chkUser = -1 '## Locked Member
		end if
	end if
 
	rsCheck.close	
	set rsCheck = nothing
 
end function


in inc_header.asp replace this section:

select case Request.Form("Method_Type")
	case "login"
		strEncodedPassword = sha256("" & Request.Form("Password"))
		select case chkUser(strDBNTFUserName, strEncodedPassword,-1)
			case 1, 2, 3, 4
				Call DoCookies(Request.Form("SavePassword"))
				strLoginStatus = 1
			case else
				strLoginStatus = 0
			end select
	case "logout"
		Call ClearCookies()
end select

with this:
select case Request.Form("Method_Type")
	case "login"
		strEncodedPassword = sha256("" & Request.Form("Password"))
		select case chkUser(strDBNTFUserName, strEncodedPassword,-1)
			case -1
				strLoginStatus = -1
			case 1, 2, 3, 4
				Call DoCookies(Request.Form("SavePassword"))
				strLoginStatus = 1
			case else
				strLoginStatus = 0
			end select
	case "logout"
		Call ClearCookies()
end select


then replace this section:
		if strLoginStatus = 0 then
			Response.Write	"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Your username and/or password were incorrect.</font></p>" & vbNewLine & _
					"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Please either try again or register for an account.</font></p>" & vbNewLine
		else
			Response.Write	"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>You logged on successfully!</font></p>" & vbNewLine & _
					"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Thank you for your participation.</font></p>" & vbNewLine
		end if

with this:
		if strLoginStatus = 0 then
			Response.Write	"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """>Your username and/or password were incorrect.</font></p>" & vbNewLine & _
					"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """>Please either try again or register for an account.</font></p>" & vbNewLine
		elseif strLoginStatus = -1 then
			Response.Write	"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """>Your account has been locked.</font></p>" & vbNewLine & _
					"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """>Please contact the Admin of this forum if you have any questions.</font></p>" & vbNewLine
		else
			Response.Write	"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>You logged on successfully!</font></p>" & vbNewLine & _
					"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Thank you for your participation.</font></p>" & vbNewLine
		end if


in login.asp find this section:
	select case chkUser(fName, strEncodedPassword,-1)
		case 1, 2, 3, 4
			Call DoCookies(Request.Form("SavePassword"))
			strLoginStatus = 1
		case else
			strLoginStatus = 0
	end select

and replace it with this:
	select case chkUser(fName, strEncodedPassword,-1)
		case -1
			strLoginStatus = -1
		case 1, 2, 3, 4
			Call DoCookies(Request.Form("SavePassword"))
			strLoginStatus = 1
		case else
			strLoginStatus = 0
	end select


then find this line : (approx. line #111)
if RequestMethod = "POST" and strLoginStatus = 0 then Response.Write("                      <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>Your username and/or password was incorrect.</font><br />" & vbNewLine) else Response.Write("<br />" & vbNewLine)

and replace it with this:
if RequestMethod = "POST" and strLoginStatus = 0 then
	Response.Write("                      <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>Your username and/or password was incorrect.</font><br />" & vbNewLine)
elseif RequestMethod = "POST" and strLoginStatus = -1 then
	Response.Write("                      <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>Your account is locked.</font><br />" & vbNewLine)
else
	Response.Write("                      <br />" & vbNewLine)
end if
Go to Top of Page

goju
New Member

Canada
67 Posts

Posted - 12 November 2002 :  15:35:30  Show Profile  Visit goju's Homepage
had some trouble with sympatico last night
thanks, i'll try that now...
Go to Top of Page

goju
New Member

Canada
67 Posts

Posted - 12 November 2002 :  16:37:26  Show Profile  Visit goju's Homepage
i'm still getting the first message in login.asp, that the password/username is incorrect.
It doesn't seem to be registering the -1 value,
where else would it be neccessary to input it so it registers in the database??
Go to Top of Page

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 12 November 2002 :  17:36:52  Show Profile  Visit MaD2ko0l's Homepage
hey try putting the ban user by cookie mod on.

here is wot to do.


Readme

Ban User by Cookie - 9 March 2002

Based on KC's code and idea. Modified by Caspoory


Description:
============
When you lock a member, the member will not be able to log in again.
However, when he will try to log in, this code will write a cookie
to his/her machine that will stop them from registering again.

However, the cookie will not stop them from viewing the forums.
This cookie will last expire after 10 year, by the time they propably
either changed the machine or became mature;)

When they click on register the cookie will be identified and will direct
them to another page (ur_banned.asp). You can change the url of this page in
the code to whatever you like, or create a page called ur_banned.asp.

Files To Be Modified.

inc_header.asp


Find This (Line 206-213)

if trim(strDBNTUserName) <> "" and trim(Request.Cookies(strUniqueID & "User")("Pword")) <> "" then
	chkCookie = 1
	mLev = cLng(chkUser(strDBNTUserName, Request.Cookies(strUniqueID & "User")("Pword"),-1))
	chkCookie = 0
else
	MemberID = -1
	mLev = 0
end if


Add this above that


'########## Ban User by Cookie Mod
Call banUser()
'####################################


Now scroll right down to the bottom adn just before the ending %> add this


'########## Ban User by Cookie Mod
Sub banUser()
	if Request.Form("Method_Type") = "login" AND strLoginStatus = 0 then
		'## Forum SQL - Get user status
		strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.M_STATUS "
		strSql = strSql & "FROM " & strMemberTablePrefix & "MEMBERS "
		strSql = strSql & "WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & getMemberNumber(strDBNTFUserName) & " "
		strSql = strSql & "AND " & strMemberTablePrefix & "MEMBERS.M_PASSWORD = '" & ChkString(Request.Form("Password"), "SQLString") & "'"

		set rsSTATUS = my_Conn.Execute(strSql)

		if rsSTATUS.EOF OR rsSTATUS.BOF then
			'DO Nothing
		elseif rsSTATUS("M_STATUS") = "0" then
			if strSetCookieToForum = 1 then
				Response.Cookies(strUniqueID & "Status").Path = strCookieURL
			else
				Response.Cookies(strUniqueID & "Status").Path = "/"
			end if
			Response.Cookies(strUniqueID & "Status")("banUser") = "1"
			Response.Cookies(strUniqueID & "Status").Expires = dateAdd("d", 3650, strForumTimeAdjust)
			errMsg = "Your account has been de-activated!"
		end if
		rsSTATUS.close
		set rsSTATUS = nothing
	end if

	Dim strScriptName, aryScriptName
	aryScriptName = Split(Request.ServerVariables("SCRIPT_NAME"), "/")
	strScriptName = aryScriptName(UBound(aryScriptName))

	if (strScriptName = "policy.asp" OR strScriptName = "register.asp") AND Request.Cookies(strUniqueID & "Status")("banUser") = "1" then
		Response.Redirect "ur_banned.asp"
	end if

end Sub
'########## END Ban User by Cookie Mod



thats it all done.

try it it shoudl work fine

© 1999-2010 MaD2ko0l
Go to Top of Page

goju
New Member

Canada
67 Posts

Posted - 12 November 2002 :  18:02:57  Show Profile  Visit goju's Homepage
no, i have some families with different users, where i only need to ban one of those users, or only temporarily lock their account because they havent been on in awhile. using the cookie ban would stop all of them from logging on.
Go to Top of Page

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 13 November 2002 :  12:17:37  Show Profile  Visit MaD2ko0l's Homepage
oh ok then it was worth a try

© 1999-2010 MaD2ko0l
Go to Top of Page

goju
New Member

Canada
67 Posts

Posted - 13 November 2002 :  17:36:06  Show Profile  Visit goju's Homepage
yeah :)... though I may use the cookie mod for really troublesome members if i need to, but thats only one family i would need it for...
Go to Top of Page

goju
New Member

Canada
67 Posts

Posted - 16 November 2002 :  14:23:22  Show Profile  Visit goju's Homepage
it works!

for some reason the comp didn't want to post
else
MemberID = -1
chkUser = -1 '## Locked Member
end if
into inc_functions.asp, even once I realized it was missing
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.58 seconds. Powered By: Snitz Forums 2000 Version 3.4.07