The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
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?
How easy would this be to mod?
Posted
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"
Next, save this file as "validate.asp"
Finally, make the following change to "register.asp"
First, run the dbs file to add a field.
"dbs_validate.asp"
Code:
Registration Validation 1.0
[ALTER]
MEMBERS_PENDING
ADD#M_NEWKEY#VARCHAR(10)#NULL#
[END]
Next, save this file as "validate.asp"
Code:
<%
'#################################################################################
'## 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"
Code:
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
Last edited by Carefree on 02 December 2013, 12:24
Posted
That looks good Carefree, I'll try it out later today and report back
Posted
Originally posted by Webbo
That looks good Carefree, I'll try it out later today and report back![]()
[IMG]http://www.smileyvault.com/albums/CBSA/smileyvault-cute-big-smiley-animated-066.gif[/IMG]
"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
Posted
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
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
Posted
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:
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
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:
Code:
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>" & vbNewLinewhich 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
Last edited by Webbo on 30 November 2013, 12:55
Posted
Best guess is that you have the wrong field definition/type for the newkey field.
Posted
It's set to:
Name: M_NEWKEY
Type: VARCHAR
Length: 10
NULL
?
Name: M_NEWKEY
Type: VARCHAR
Length: 10
NULL
?
Posted
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...
The code is see doing that is...
Code:
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
Posted
That's correct. Make the following change and let me know what it reports.
Code:
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
Posted
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
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
Last edited by Webbo on 01 December 2013, 04:12
Email Member
Message Member
Post Moderation
FileUpload
If you're having problems uploading, try choosing a smaller image.
Preview post
Send Topic
Loading...