'=========
Case 4 'Use custom avatar
'actually changed to CHANGE USERNAME
'=========
CreateTable(ItemTitle)
If DoIt <> True Then
Call ShowStats()
Response.Write "<font size=""" & strFooterFontSize & """>You can only change your username ONCE IN YOUR LIFE, so better think twice before doing so.<br> DO NOT use real life names, phone numbers or anything else you might regret later on. <br>Spaces, dots or other special characters are NOT available in your new username.</font><br>"
Response.Write "<table width=""100%"" border=0><tr><td align=center>" & VbNewLine &_
"<b>Current Username: " & strDBNTUserName & "</b><br><br>" & VbNewLine
Response.Write "</td><td align=left>"
Response.Write "<br>New Username: <br><input name=""UserChange"" value=""MyNewUsername"" size=50><br>"
Response.Write "</td></tr></table>" & VbNewLine
Response.Write "<font size=""" & strFooterFontSize & """>You will NOT be able to log in with your OLD username after the change. <br>You will NEVER be able to change your username again after the change.<br> There is NO additional check so TRIPLE check for typos before submitting.</font><br>"
CloseTable(1)
Else
if not IsValidString(trim(Request.Form("UserChange"))) then
Response.Write "<br><br><li>You may not use any of these characters or a space in your Username !#$%^&*()=+{}[]|\;:/?>,<'. </li>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:history.go(-1)"">Go Back To Edit Data</a></font></p>" & vbNewLine
WriteFooter
Response.End
end if
If Request.Form("UserChange") = "" Or len(Request.Form("UserChange")) <=2 Then
Response.Write "<br><br><li>Please enter a valid username. Minimum length is 2 characters.</li>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:history.go(-1)"">Go Back To Edit Data</a></font></p>" & vbNewLine
WriteFooter
Response.End
End If
'If mid(Request.Form("UserChange"), 1, 7) <> "http://" Then
' strErr = "<li>URL's must start with ""http://"""
'End If
'######check username already in use
strSql = "SELECT M_NAME FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE M_NAME = '" & ChkString(Trim(Request.Form("UserChange")), "SQLString") &"'"
set rs = my_Conn.Execute (strSql)
if rs.BOF and rs.EOF then
'## Do Nothing
else
Response.Write "<br><br><li>Error: This Username is already taken.</li>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:history.go(-1)"">Go Back To Edit Data</a></font></p>" & vbNewLine
WriteFooter
Response.End
end if
rs.close
set rs = nothing
'######end check username in use
'#####check pending
strSql = "SELECT M_NAME FROM " & strMemberTablePrefix & "MEMBERS_PENDING "
strSql = strSql & " WHERE M_NAME = '" & ChkString(Trim(Request.Form("Name")), "SQLString") &"'"
set rs = my_Conn.Execute (strSql)
if rs.BOF and rs.EOF then
'## Do Nothing
else
Response.Write "<br><br><li>Error: This Username is already taken.</li>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:history.go(-1)"">Go Back To Edit Data</a></font></p>" & vbNewLine
WriteFooter
Response.End
end if
rs.close
set rs = nothing
'####end check pending
'######check username already changed
strSql = "SELECT M_CHANGEDNAME FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " where MEMBER_ID=" & MemberID
set rs = my_Conn.Execute (strSql)
if rs.BOF and rs.EOF then
'## Do Nothing
'wtf? nothing???
else
if rs("M_CHANGEDNAME") > 0 then
Response.Write "<br><br><li>Error: You already changed your username once. Sorry but we said ONCE IN A LIFETIME and we mean it.</li>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:history.go(-1)"">Go Back</a></font></p>" & vbNewLine
WriteFooter
Response.End
end if
end if
rs.close
set rs = nothing
'######end check username already changed
If strErr <> "" Then
GoError(strErr)
Else
strSql = "update " & strTablePrefix & "MEMBERS set M_NAME = '" & chkString(Request.Form("UserChange"), "SQLString") & "', " &_
"M_POINTS = M_POINTS -" & ItemCost &_
" where MEMBER_ID=" & MemberID
my_Conn.Execute (strsql)
'update change count
strSql = "update " & strTablePrefix & "MEMBERS set M_CHANGEDNAME = '1'" &_
" where MEMBER_ID=" & MemberID
my_Conn.Execute (strsql)
UpdateItemCount
Response.Write "<br>YOUR USERNAME WAS CHANGED."
Call BackToStore
End If
CloseTable(0)
End If
Function IsValidString(sValidate)
Dim sInvalidChars
Dim bTemp
Dim i
' Disallowed characters
sInvalidChars = "!#$%^&*()=+{}[]|\;:/?>,<'"
for i = 1 To Len(sInvalidChars)
if InStr(sValidate, Mid(sInvalidChars, i, 1)) > 0 then bTemp = True
if bTemp then Exit For
next
for i = 1 to Len(sValidate)
if Asc(Mid(sValidate, i, 1)) = 160 then bTemp = True
if bTemp then Exit For
next
' extra checks
' no two consecutive dots or spaces
if not bTemp then
bTemp = InStr(sValidate, ".") > 0
end if
if not bTemp then
bTemp = InStr(sValidate, " ") > 0
end if
if not bTemp then
bTemp = (len(sValidate) <> len(Trim(sValidate)))
end if 'Addition for leading and trailing spaces
' if any of the above are true, invalid string
IsValidString = Not bTemp
End Function
User Name Change 1.0
[ALTER]
MEMBERS
ADD#M_CHANGEDNAME#VARCHAR(75)#NULL#
[END]
<%
'###############################################################################
'##
'## Snitz Forums 2000 v3.4.07
'##
'###############################################################################
'##
'## Copyright © 2000-09 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## This program is free. You can redistribute and/or modify it under the
'## terms of the GNU General Public License as published by the Free Software
'## Foundation; either version 2 or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000 must remain intact in
'## the scripts and in the HTML output. 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 an 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:
'##
'## Free Software Foundation, Inc.
'## 59 Temple Place, Suite 330
'## Boston, MA 02111-1307
'##
'## Support can be obtained from our support forums at:
'##
'## http://forum.snitz.com
'##
'## Correspondence and marketing questions can be sent to:
'##
'## manderson@snitz.com
'##
'###############################################################################
'##
'## Based on Kyodai's Points' Namechange
'##
'###############################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<!--#INCLUDE FILE="inc_func_member.asp" -->
<%
Response.Write "<table border=""0"" width=""100%"" align=""center"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""33%"" align=""left"" nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" " & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a><br>" & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & "<a href=""changeme.asp"">Change Username</a></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table><br />"
If MemberID < 1 Then goError "You must be signed in to use this program.",1
strSql = "SELECT M_CHANGEDNAME FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID=" & MemberID
Set rs = my_Conn.Execute (strSql)
If NOT (rs.BOF or rs.EOF) Then
If rs("M_CHANGEDNAME") > "" Then
rs.Close
Set rs = Nothing
goError "Error: You already changed your username, it cannot be changed again.",2
End If
End If
Set rs = Nothing
If Request.Form("DoIt") <> "ChangeMe" Then
Response.Write "<form action=""ChangeMe.asp"" method=""post"">" & vbNewLine & _
"<input type=""hidden"" name=""DoIt"" value=""ChangeMe"">" & vbNewLine & _
"<table align=""center"" width=""80%"" style=""border-collapse:collapse;"" border=""1"" bgColor=""" & strPageBGColor & """ cellspacing=""1"" cellpadding=""3"">" & vbNewLine & _
" <tr height=""60"" valign=""middle"">" & vbNewLine & _
" <td align=""center"" colspan=""2"" width=""100%"" bgColor=""" & strCategoryCellColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize+2 & """><b>User Name Changer</b>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""right"" width=""50%"" bgColor=""" & strPopupTableColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strHeaderFontSize & """>Current Name:" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" width=""50%"" bgColor=""" & strPopupTableColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """>" & strDBNTUserName & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""right"" width=""50%"" bgColor=""" & strPopupTableColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strHeaderFontSize & """>Desired Name:" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" width=""50%"" bgColor=""" & strPopupTableColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <input type=""text"" name=""NewUserName"" size=""50"" maxlength=""75"">" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""right"" width=""50%"" bgColor=""" & strPopupTableColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strHeaderFontSize & """>Replace UserName on Posts?" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" width=""50%"" bgColor=""" & strPopupTableColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <input type=""radio"" class=""radio"" name=""Retain"" value=""Yes""" & chkRadio(Retain,"Yes",true) & ">Yes" & _
" <input type=""radio"" class=""radio"" name=""Retain"" value=""No""" & chkRadio(Retain,"No",true) & ">No" & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""left"" colspan=""2"" width=""100%"" bgColor=""" & strAltForumCellColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """><br>" & vbNewLine & _
" 1. You can only change your username <b>ONCE</b>, so be sure before doing so.<br>" & vbNewLine & _
" 2. Do <b>NOT</b> use your real name, phone number or anything else you might regret.<br>" & vbNewLine & _
" 3. Spaces, dots or other special characters are <b>NOT</b> available in your new Username.<br>" & vbNewLine & _
" 4. You will <b>NOT</b> be able to log in with your current Username after the change.<br>" & vbNewLine & _
" 5. There is <b>NO</b> confirmation so TRIPLE check for typos before submitting.<br><br>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""center"" colspan=""2"" width=""100%"" bgColor=""" & strPageBGColor & """>" & vbNewLine & _
" <input type=""Submit"" value=""Change Name"" name=""Submit"">" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>" & vbNewLine & _
"</form>" & vbNewLine
Else
If NOT IsValidString(trim(Request.Form("NewUserName"))) Then
GoError "<br><br><li>You may not use any of these characters or spaces in your User Name !#$%^&*()=+{}[]|\;:/?>,<'. </li>",0
End If
If isNull(Request.Form("NewUserName")) Then
GoError "<br><br><li>Please enter a valid username. Minimum length is 3 characters.</li>",0
ElseIf len(Request.Form("NewUserName")) < 3 Then
GoError "<br><br><li>Please enter a valid username. Minimum length is 3 characters.</li>",0
End If
strSql = "SELECT M_NAME FROM " & strMemberTablePrefix & "MEMBERS WHERE M_NAME = '" & ChkString(Trim(Request.Form("NewUserName")), "SQLString") &"'"
Set rs = my_Conn.Execute(strSql)
If NOT (rs.BOF or rs.EOF) Then
rs.Close
GoError "<br><br><li>Error: Username is already taken.</li>",0
End If
rs.Close
Set rs = Nothing
strSql = "SELECT M_NAME FROM " & strMemberTablePrefix & "MEMBERS_PENDING WHERE M_NAME = '" & ChkString(Trim(Request.Form("NewUserName")), "SQLString") &"'"
Set rs = my_Conn.Execute(strSql)
If NOT (rs.BOF or rs.EOF) Then
rs.Close
GoError "<br><br><li>Error: Username is already taken.</li>",0
End If
rs.Close
Set rs = Nothing
strSql = "SELECT M_CHANGEDNAME FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID=" & MemberID
Set rs = my_Conn.Execute (strSql)
If NOT (rs.BOF or rs.EOF) Then
rs.Close
Set rs = Nothing
If rs("M_CHANGEDNAME") > "" Then
GoError "<br><br><li>Error: You already changed your username, it cannot be changed again.</li>",0
End If
End If
strSql = "SELECT WORDLIST FROM " & strTablePrefix & "COMMON WHERE WORDLIST='" & chkString(Request.Form("NewUserName"), "SQLString") & "'"
Set rs=my_Conn.Execute(strSql)
if not rs.EOF Then
rs.Close
Set rs = Nothing
GoError "<br><br><li>Requested username is too common, please select another.</li>",0
End If
Set rs = Nothing
If Request.Form("Retain") = "Yes" then
strSql = "INSERT INTO " & strTablePrefix & "BADWORDS (B_BADWORD, B_REPLACE) VALUES ('" & chkString(Request.Form("NewUserName"), "SQLString") & "', '" & strDBNTUserName & "')"
my_Conn.Execute(strSql)
End if
strSql = "UPDATE "& strMemberTablePrefix & "MEMBERS SET M_NAME='" & chkString(Request.Form("NewUserName"), "SQLString") & "', M_CHANGEDNAME='" & strDBNTUserName & "' WHERE MEMBER_ID=" & MemberID
my_Conn.Execute(strSql)
Call ClearCookies()
LoginStatus = 0
GoError "<br>Your username has been changed. You must login using the new name.",1
End If
Function GoError(Err_Msg,i)
Response.Write "<table align=""center"" width=""75%"" bgColor=""" & strPageBGColor & """ style=""border-collapse:collapse;"" border=""1"">" & vbNewLine & _
" <tr height=""60"" valign=""middle"">" & vbNewLine & _
" <td align=""left"" width=""100%"" bgColor=""" & strForumCellColor & """>" & vbNewLine & _
" <font size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """><p align=""center"">" & Err_Msg & vbNewLine
If i=0 Then
Response.Write " <br /><br /><a href=""JavaScript:history.go(-1)"">Go Back To Edit Data</a></p>" & vbNewLine
ElseIf i=1 Then
Response.Write " <br /><br /><a href=""login.asp"">Login</a></p>" & vbNewLine
Else
Response.Write " <br /><br /><a href=""JavaScript:history.go(-1)"">Return</a></p>" & vbNewLine
End If
Response.Write " </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>" & vbNewLine
WriteFooter
Response.End
End Function
Function IsValidString(sValidate)
Dim sInvalidChars
Dim bTemp
Dim i
sInvalidChars = "!#$%^&*()=+{}[]|\;:/?>,<' ."
For i = 1 To Len(sInvalidChars)
If InStr(sValidate, Mid(sInvalidChars, i, 1)) > 0 Then bTemp = True
If bTemp then Exit For
Next
For i = 1 to Len(sValidate)
If Asc(Mid(sValidate, i, 1)) = 160 Then bTemp = True
If bTemp Then Exit For
Next
If NOT bTemp Then
bTemp = (len(sValidate) <> len(Trim(sValidate)))
End If
IsValidString = Not bTemp
End Function
WriteFooter
%>
For header:
In "inc_header.asp", look for the following line (appx 512):
' DEM --> End of Code added to show subscriptions if they exist
Below it, insert these:
If MemberID<>intAdminMemberID Then
strSql = "SELECT M_CHANGEDNAME FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID=" & MemberID
Set rsNC = my_Conn.Execute (strSql)
If NOT (rsNC.BOF or rsNC.EOF) Then
If isNull(rsNC("M_CHANGEDNAME")) Then
Response.Write " |" & vbNewline & _
" <a href=""changeme.asp""" & dWStatus("Change Username") & " tabindex=""-1""><acronym title=""Change Username"">Change Username</acronym></a>" & vbNewline
ElseIf len(rsNC("M_CHANGEDNAME")) < 3 Then
Response.Write " |" & vbNewline & _
" <a href=""changeme.asp""" & dWStatus("Change Username") & " tabindex=""-1""><acronym title=""Change Username"">Change Username</acronym></a>" & vbNewline
End If
rsNC.Close
End If
Set rsNC = Nothing
End If
For profile:
In "inc_profile.asp", look for the following lines (appx 307-309):
Response.Write " </font></td>" & vbNewLine & _
" </tr>" & vbNewLine
if strMode = "goModify" or sLev > 0 then
Change the first two lines (line 307-308) to say:
If MemberID <> intAdminMemberID Then
strSql = "SELECT M_CHANGEDNAME FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID=" & MemberID
Set rsNC = my_Conn.Execute (strSql)
If NOT (rsNC.BOF or rsNC.EOF) Then
If isNull(rsNC("M_CHANGEDNAME")) Then
Response.Write " </font> <a href=""changeme.asp"">" & getCurrentIcon(strIconPencil,"Change Name","hspace=""0""") & "</a></td>" & vbNewLine & _
" </tr>" & vbNewLine
ElseIf len(rsNC("M_CHANGEDNAME"))<3 Then
Response.Write " </font> <a href=""changeme.asp"">" & getCurrentIcon(strIconPencil,"Change Name","hspace=""0""") & "</a></td>" & vbNewLine & _
" </tr>" & vbNewLine
Else
Response.Write " </font></td>" & vbNewLine & _
" </tr>" & vbNewLine
End If
rsNC.Close
End If
Set rsNC = Nothing
End If
Common Word Table
[INSERT]
COMMON
(WORDLIST,REPLACE)#('0','')
(WORDLIST,REPLACE)#('1','')
(WORDLIST,REPLACE)#('2','')
(WORDLIST,REPLACE)#('3','')
(WORDLIST,REPLACE)#('4','')
(WORDLIST,REPLACE)#('5','')
(WORDLIST,REPLACE)#('6','')
(WORDLIST,REPLACE)#('7','')
(WORDLIST,REPLACE)#('8','')
(WORDLIST,REPLACE)#('9','')
(WORDLIST,REPLACE)#('a','')
(WORDLIST,REPLACE)#('am','')
(WORDLIST,REPLACE)#('and','')
(WORDLIST,REPLACE)#('are','')
(WORDLIST,REPLACE)#('be','')
(WORDLIST,REPLACE)#('being','')
(WORDLIST,REPLACE)#('but','')
(WORDLIST,REPLACE)#('down','')
(WORDLIST,REPLACE)#('for','')
(WORDLIST,REPLACE)#('from','')
(WORDLIST,REPLACE)#('had','')
(WORDLIST,REPLACE)#('has','')
(WORDLIST,REPLACE)#('have','')
(WORDLIST,REPLACE)#('her','')
(WORDLIST,REPLACE)#('hers','')
(WORDLIST,REPLACE)#('him','')
(WORDLIST,REPLACE)#('his','')
(WORDLIST,REPLACE)#('how','')
(WORDLIST,REPLACE)#('I','')
(WORDLIST,REPLACE)#('if','')
(WORDLIST,REPLACE)#('in','')
(WORDLIST,REPLACE)#('is','')
(WORDLIST,REPLACE)#('it','')
(WORDLIST,REPLACE)#('left','')
(WORDLIST,REPLACE)#('my','')
(WORDLIST,REPLACE)#('no','')
(WORDLIST,REPLACE)#('nor','')
(WORDLIST,REPLACE)#('not','')
(WORDLIST,REPLACE)#('of','')
(WORDLIST,REPLACE)#('our','')
(WORDLIST,REPLACE)#('ours','')
(WORDLIST,REPLACE)#('out','')
(WORDLIST,REPLACE)#('right','')
(WORDLIST,REPLACE)#('than','')
(WORDLIST,REPLACE)#('that','')
(WORDLIST,REPLACE)#('the','')
(WORDLIST,REPLACE)#('their','')
(WORDLIST,REPLACE)#('theirs','')
(WORDLIST,REPLACE)#('them','')
(WORDLIST,REPLACE)#('then','')
(WORDLIST,REPLACE)#('they','')
(WORDLIST,REPLACE)#('this','')
(WORDLIST,REPLACE)#('to','')
(WORDLIST,REPLACE)#('too','')
(WORDLIST,REPLACE)#('up','')
(WORDLIST,REPLACE)#('was','')
(WORDLIST,REPLACE)#('were','')
(WORDLIST,REPLACE)#('what','')
(WORDLIST,REPLACE)#('when','')
(WORDLIST,REPLACE)#('where','')
(WORDLIST,REPLACE)#('who','')
(WORDLIST,REPLACE)#('why','')
(WORDLIST,REPLACE)#('you','')
(WORDLIST,REPLACE)#('your','')
[END]