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)
 Verification Code on Registration
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Webbo
Average Member

United Kingdom
982 Posts

Posted - 06 October 2013 :  09:00:53  Show Profile  Visit Webbo's Homepage  Reply with Quote
With more and more people using mobiles and some browsers breaking up the activation link resulting in more and more people not activating their accounts via email validation, an idea would be to have a random generated code, say six numbers or letters long that prospective members would be sent via email and once they accessed the email would have to return to the site and put the code into a form field to activate their membership

How easy would this be to mod?

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 07 October 2013 :  04:35:22  Show Profile  Reply with Quote
Very simple, actually. You'd have to make a single change to the database; change about 10 lines of "register.asp" and add a single file. This is untested, but here's what you could do to give your users a choice on validation methods:

First, run the dbs file to add a field.

"dbs_validate.asp"


Registration Validation 1.0

[ALTER]
MEMBERS_PENDING
ADD#M_NEWKEY#VARCHAR(10)#NULL#
[END]


Next, save this file as "validate.asp"


<%
'#################################################################################
'## Snitz Forums 2000 v3.4.07
'#################################################################################
'## Copyright (C) 2000-09 Michael Anderson, Pierre Gorissen,
'##                       Huw Reddick and Richard Kinser
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
'##
'## Support can be obtained from our support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## manderson@snitz.com
'##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<%
If Request.Form("Key")>"" Then
	strSql="SELECT M_NAME, M_PASSWORD, M_NEWKEY FROM " & strMemberTablePrefix & "MEMBERS_PENDING WHERE lCase(M_NAME)='" & trim(lCase(Request.Form("UserName"))) & "' AND M_PASSWORD='" & strEncodedPassword & "' AND M_NEWKEY='" & trim(Request.Form("Key")) & "'"
	Set rsValid=my_Conn.Execute(strSql)
	If not rsValid.EOF Then
		rsValid.Close
		Set rsValid=Nothing
		strSql = "SELECT M_NAME, M_USERNAME, M_PASSWORD, M_KEY, M_LEVEL, M_EMAIL, M_DATE, M_COUNTRY, M_AIM, M_ICQ, M_MSN, M_YAHOO" & _
			", M_POSTS, M_HOMEPAGE, M_LASTHEREDATE, M_STATUS, M_RECEIVE_EMAIL, M_LAST_IP, M_IP, M_SIG, M_VIEW_SIG, M_SIG_DEFAULT" & _
			", M_FIRSTNAME, M_LASTNAME, M_CITY, M_STATE, M_PHOTO_URL, M_LINK1, M_LINK2, M_AGE, M_DOB, M_MARSTATUS, M_SEX, M_OCCUPATION" & _
			", M_BIO, M_HOBBIES, M_LNEWS, M_QUOTE, M_SHA256" & _
			" FROM " & strMemberTablePrefix & "MEMBERS_PENDING" & _
			" WHERE lCase(M_NAME) = '" & trim(lCase(Request.Form("UserName"))) & "'"
		set rsKey = my_Conn.Execute (strSql)
		strSql = "INSERT INTO " & strMemberTablePrefix & "MEMBERS "
		strSql = strSql & "(M_NAME"
		strSql = strSql & ", M_USERNAME"
		strSql = strSql & ", M_PASSWORD"
		strSql = strSql & ", M_LEVEL"
		strSql = strSql & ", M_EMAIL"
		strSql = strSql & ", M_DATE"
		strSql = strSql & ", M_COUNTRY"
		strSql = strSql & ", M_AIM"
		strSql = strSql & ", M_ICQ"
		strSql = strSql & ", M_MSN"
		strSql = strSql & ", M_YAHOO"
		strSql = strSql & ", M_POSTS"
		strSql = strSql & ", M_HOMEPAGE"
		strSql = strSql & ", M_LASTHEREDATE"
		strSql = strSql & ", M_STATUS"
		strSql = strSql & ", M_RECEIVE_EMAIL"
		strSql = strSql & ", M_LAST_IP"
		strSql = strSql & ", M_IP"
		strSql = strSql & ", M_SIG"
		strSql = strSql & ", M_VIEW_SIG"
		strSql = strSql & ", M_SIG_DEFAULT"
		strSql = strSql & ", M_FIRSTNAME"
		strSql = strSql & ", M_LASTNAME"
		strSql = strSql & ", M_CITY"
		strSql = strSql & ", M_STATE"
		strSql = strSql & ", M_PHOTO_URL"
		strSql = strSql & ", M_LINK1"
		strSql = strSql & ", M_LINK2"
		strSql = strsql & ", M_AGE"
		strSql = strsql & ", M_DOB"
		strSql = strSql & ", M_MARSTATUS"
		strSql = strsql & ", M_SEX"
		strSql = strSql & ", M_OCCUPATION"
		strSql = strSql & ", M_BIO"
		strSql = strSql & ", M_HOBBIES"
		strsql = strsql & ", M_LNEWS"
		strSql = strSql & ", M_QUOTE"
		strSql = strSql & ", M_SHA256"
		strSql = strSql & ") "
		strSql = strSql & " VALUES ("
		strSql = strSql & "'" & chkString(rsKey("M_NAME"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_USERNAME"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_PASSWORD"),"SQLString") & "'"
		strSql = strSql & ", " & "1"
		strSql = strSql & ", '" & chkString(rsKey("M_EMAIL"),"SQLString") & "'"
		strSql = strSql & ", '" & DateToStr(strForumTimeAdjust) & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_COUNTRY"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_AIM"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_ICQ"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_MSN"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_YAHOO"),"SQLString") & "'"
		strSql = strSql & ", 0"
		strSql = strSql & ", '" & chkString(rsKey("M_HOMEPAGE"),"SQLString") & "'"
		strSql = strSql & ", '" & DateToStr(strForumTimeAdjust) & "'"
		strSql = strSql & ", 1"
		strSql = strSql & ", " & cLng(rsKey("M_RECEIVE_EMAIL")) & " "
		strSql = strSql & ", '" & chkString(rsKey("M_LAST_IP"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_IP"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_SIG"),"message") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_VIEW_SIG"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_SIG_DEFAULT"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_FIRSTNAME"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_LASTNAME"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_CITY"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_STATE"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_PHOTO_URL"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_LINK1"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_LINK2"),"SQLString") & "'"
		strSql = strsql & ", '" & chkString(rsKey("M_AGE"),"SQLString") & "'"
		strSql = strsql & ", '" & chkString(rsKey("M_DOB"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_MARSTATUS"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_SEX"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_OCCUPATION"),"SQLString") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_BIO"),"message") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_HOBBIES"),"message") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_LNEWS"),"message") & "'"
		strSql = strSql & ", '" & chkString(rsKey("M_QUOTE"),"message") & "'"
		strSql = strSql & ", 1"
		strSql = strSql & ")"
		my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
		Call DoCount
		strSql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS_PENDING "
		strSql = strSql & " WHERE lCase(M_NAME) = '" & trim(lCase(Request.Form("UserName"))) & "'"
		my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
		Response.Write	"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>Your Registration Has Been Completed!</b></font></p>" & vbNewLine & _
				"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>You may now begin posting"
		if strAuthType="db" then Response.Write(" using your new UserName and Password")
		Response.Write	".</font></p>" & vbNewLine & _
				"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""default.asp"">Back To Forum</a></font></p>" & vbNewLine
		rsKey.close
		set rsKey = nothing
		WriteFooter
		Response.End
	Else
		Set rsValid=Nothing
		Response.Write	"<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """>Information does not match our records.  Go <a href=""Javascript:history.go(-1)"">back</a> to try again.</p>"
		WriteFooter
		Response.End
	End If
End If
Response.Write	"<form action=""validate.asp"" method=""post"">" & vbNewLine & _
	"<table align=""center"" width=""50%"" bgColor=""" &  strTableBorderColor &  """ border=""0"" cellpadding=""0"" cellspacing=""0"">" & vbNewLine & _
	"	<tr valign=""middle"">" & vbNewLine & _
	"		<td align=""center"" width=""100%"" bgColor=""" & strPageBGColor & """>" & vbNewLine & _
	"			<table align=""center"" width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellpadding=""4"" cellspacing=""1"">" & vbNewLine & _
	"				<tr valign=""middle"">" & vbNewLine & _
	"					<td align=""center"" colspan=""2"" bgColor=""" & strHeadCellColor & """>" & vbNewLine & _
	"						<font face=""" & strHeadFontFace & """ size=""" & strHeaderFontSize &  """ color=""" & strHeadFontColor & """>Forum Validation</font>" & vbNewLine & _
	"					</td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"				<tr valign=""middle"">" & vbNewLine & _
	"					<td align=""right"" width=""50%"" bgColor=""" & strForumCellColor & """>" & vbNewLine & _
	"						<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize &  """ color=""" & strForumFontColor & """><b>User Name: </b></font>" & vbNewLine & _
	"					</td>" & vbNewLine & _
	"					<td align=""left"" width=""50%"" bgColor=""" & strForumCellColor & """>" & vbNewLine & _
	"						<input type=""text"" name=""UserName"" value=""" & Request("UserName") & """ size=""30"" maxlength=""75"" style=""width:95%;"" />" & vbNewLine & _
	"					</td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"				<tr valign=""middle"">" & vbNewLine & _
	"					<td align=""right"" width=""50%"" bgColor=""" & strForumCellColor & """>" & vbNewLine & _
	"						<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize &  """ color=""" & strForumFontColor & """><b>Password: </b></font>" & vbNewLine & _
	"					</td>" & vbNewLine & _
	"					<td align=""left"" width=""50%"" bgColor=""" & strForumCellColor & """>" & vbNewLine & _
	"						<input type=""Password"" name=""Password"" value="""" size=""30"" maxlength=""75"" style=""width:95%;"" />" & vbNewLine & _
	"					</td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"				<tr valign=""middle"">" & vbNewLine & _
	"					<td align=""right"" width=""50%"" bgColor=""" & strForumCellColor & """>" & vbNewLine & _
	"						<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize &  """ color=""" & strForumFontColor & """><b>EMail Key: </b></font>" & vbNewLine & _
	"					</td>" & vbNewLine & _
	"					<td align=""left"" width=""50%"" bgColor=""" & strForumCellColor & """>" & vbNewLine & _
	"						<input type=""text"" name=""Key"" value=""" & Request("Key") & """ size=""30"" maxlength=""10"" style=""width:95%;"" />" & vbNewLine & _
	"					</td>" & vbNewLine & _
	"				</tr>" & vbNewLine & _
	"			</table>" & vbNewLine & _
	"			<p align=""center""><input type=""submit"" value=""Submit"">" & vbNewLine & _
	"		</td>" & vbNewLine & _
	"	</tr>" & vbNewLine & _
	"</table>"
WriteFooter

sub DoCount
	'## Forum_SQL - Updates the Totals table by adding 1 to U_COUNT
	strSql = "UPDATE " & strTablePrefix & "TOTALS "
	strSql = strSql & " SET " & strTablePrefix & "TOTALS.U_COUNT = " & strTablePrefix & "TOTALS.U_COUNT + 1"
	my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end sub
%>


Finally, make the following change to "register.asp"


Look for the following lines (appx 762-766):

				'################################### E-mail Validation Mod #################################
					if strEmailVal = "1" then
						strMessage = strMessage & "Please click on the link below to complete your registration." & vbNewline & vbNewLine
						strMessage = strMessage & "If the link is split or broken, you will need to copy and paste the entire link into your web browser." & vbNewline & vbNewLine
						strMessage = strMessage & strForumURL & "register.asp?actkey=" & actkey & vbNewline & vbNewline

Change them to say:

				'################################### E-mail Validation Mod #################################
					if strEmailVal = "1" then
						'	Manual Validation Below
						strJJ=""
						strValid="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
						For i = 1 to 10
							Randomize
							j=int(Rnd * 36) + 1
							strJJ=strJJ+mid(strValid,j,1)
						Next
						strSql="UPDATE " & strMemberTablePrefix & "MEMBERS_PENDING SET M_NEWKEY = '" & strJJ & "' WHERE M_NAME='" & chkString(trim(Request.Form("Name")),"SQLString") & "'"
						my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
						strMessage = strMessage &	"You will need this code to complete registration:  " & strJJ & vbNewline & vbNewline
						strMessage = strMessage & "Either click this link to automatically validate your registration, or click the second link below to enter the code manually." & vbNewline & vbNewLine
						strMessage = strMessage & "Automatic:  " & strForumURL & "register.asp?actkey=" & actkey & vbNewline & vbNewline
						strMessage = strMessage & "Manual:  " & strForumURL & "validate.asp" & vbNewline & vbNewline
						'	Manual Validation Above

Edited by - Carefree on 02 December 2013 12:24:20
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 09 October 2013 :  01:55:42  Show Profile  Visit Webbo's Homepage  Reply with Quote
That looks good Carefree, I'll try it out later today and report back
Go to Top of Page

MaGraham
Senior Member

USA
1297 Posts

Posted - 27 October 2013 :  12:30:18  Show Profile  Reply with Quote
quote:
Originally posted by Webbo

That looks good Carefree, I'll try it out later today and report back






"Do all the good you can, by all the means you can, in all the ways you can, at all the times you can, to all the people you can, as long as ever you can." - John Wesley
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 27 October 2013 :  16:41:25  Show Profile  Visit Webbo's Homepage  Reply with Quote
ROFLMAO ^^^ Nice smilie

Been a bit hectic in the household with a first grandson being born and a traumatic birth (youngest daughter) so with that and work everything else has had to take a back seat
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 30 November 2013 :  12:50:54  Show Profile  Visit Webbo's Homepage  Reply with Quote
Hi Carefree,

I finally got round to adding this and found a few problems..

The dbs file wouldn't work on a MySql database for some reason so I manually created the column M_NEWKEY


There were a couple of errors in the code for validate.asp at line 149
I changed the code to:

     Response.Write "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """>Information does not match our records.  Go <a href=""Javascript:history.go(-1)"">back</a> to try again.</p>" & vbNewLine


which worked,

however when using the generated code when registering the form in validate.asp doesn't work and the user is repeatedly asked for their password.
Checking the database it looks like the 10 character code isn't being written to it and the value is remaining NULL



If I get a bit more time I'll look into it a bit further


Regards

Edited by - Webbo on 30 November 2013 12:55:57
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 30 November 2013 :  13:54:34  Show Profile  Reply with Quote
Best guess is that you have the wrong field definition/type for the newkey field.
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 30 November 2013 :  15:04:36  Show Profile  Visit Webbo's Homepage  Reply with Quote
It's set to:

Name: M_NEWKEY
Type: VARCHAR
Length: 10
NULL


?
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 30 November 2013 :  15:56:35  Show Profile  Visit Webbo's Homepage  Reply with Quote
The verfication code is being generated and added into the activation email but isn't being written into the database

The code is see doing that is...


Next
strSql="UPDATE " & strMemberTablePrefix & "MEMBERS_PENDING SET M_NEWKEY = '" & strJJ & "' WHERE M_USERNAME='" & chkString(trim(Request.Form("Name")),"SQLString") & "'"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 30 November 2013 :  22:52:45  Show Profile  Reply with Quote
That's correct. Make the following change and let me know what it reports.


After this line:

						strSql="UPDATE " & strMemberTablePrefix & "MEMBERS_PENDING SET M_NEWKEY = '" & strJJ & "' WHERE M_USERNAME='" & chkString(trim(Request.Form("Name")),"SQLString") & "'"


Insert this:

						Response.Write	strSql
						WriteFooter
						Response.End
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 01 December 2013 :  03:54:11  Show Profile  Visit Webbo's Homepage  Reply with Quote
It shows:

UPDATE FORUM_MEMBERS_PENDING SET M_NEWKEY = '8IXY4B8S3G' WHERE M_USERNAME='validate'

('validate' is the username I used to register )

The username is entered into the MEMBERS_PENDING table along with any registration info but the Newkey value isn't

Edited by - Webbo on 01 December 2013 04:12:20
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 01 December 2013 :  06:54:02  Show Profile  Reply with Quote
Duhhh. Color me red. Change M_USERNAME to M_NAME.

Fixed in original instructions. Also changed "validate.asp" in original.

Edited by - Carefree on 01 December 2013 07:23:19
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 01 December 2013 :  08:41:21  Show Profile  Visit Webbo's Homepage  Reply with Quote
Lol, which shade of red would you prefer

I'm out and about at the moment but will do it when I get back in and report back
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 01 December 2013 :  11:30:07  Show Profile  Visit Webbo's Homepage  Reply with Quote
Okay, it's now writing to the database but when you enter the username, password and key into validate.asp and submit it it throws up the following error:

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "SELECT M_NAME, M_PAS"]'

/forum/validate.asp, line 41
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 01 December 2013 :  16:18:09  Show Profile  Reply with Quote
Looks like you copied it wrong, may want to recopy the file. That line should be:

	strSql="SELECT M_NAME, M_PASSWORD, M_NEWKEY FROM " & strMemberTablePrefix & "MEMBERS_PENDING WHERE lCase(M_NAME)='" & trim(lCase(Request.Form("UserName"))) & "' AND M_PASSWORD='" & strEncodedPassword & "' AND M_NEWKEY='" & trim(Request.Form("Key")) & "'"

Edited by - Carefree on 02 December 2013 12:25:07
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 01 December 2013 :  16:54:56  Show Profile  Visit Webbo's Homepage  Reply with Quote
That's what I've got and I just loaded the above line to make sure and still get the error message:

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "SELECT M_NAME, M_PAS"]'

/forum/validate.asp, line 41


I've played with it for a while and can't seem to work out where the mismatch is
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07