% Option Explicit %> <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide - Web Wiz Mailing List '** '** Copyright 2001-2004 Bruce Corkhill All Rights Reserved. '** '** This program is free software; you can modify (at your own risk) any part of it '** under the terms of the License that accompanies this software and use it both '** privately and commercially. '** '** All copyright notices must remain in tacked in the scripts and the '** outputted HTML. '** '** You may use parts of this program in your own private work, but you may NOT '** redistribute, repackage, or sell the whole or any part of this program even '** if it is modified or reverse engineered in whole or in part without express '** permission from the author. '** '** You may not pass the whole or any part of this application off as your own work. '** '** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place '** and must remain visible when the pages are viewed unless permission is first granted '** by the copyright holder. '** '** This program is distributed in the hope that it will be useful, '** but WITHOUT ANY WARRANTY; without even the implied warranty of '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER '** WARRANTIES WHETHER EXPRESSED OR IMPLIED. '** '** You should have received a copy of the License along with this program; '** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom. '** '** '** No official support is available for this program but you may post support questions at: - '** http://www.webwizguide.info/forum '** '** Support questions are NOT answered by e-mail ever! '** '** For correspondence or non support questions contact: - '** info@webwizguide.info '** '** or at: - '** '** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom '** '**************************************************************************************** 'Set the response buffer to true as we maybe redirecting Response.Buffer = True 'Declare variables Dim rsCategories 'Recordset to hold the categories Dim strEmail 'Holds the users e-mail address Dim strOldEmail 'Hols teh users old email address Dim strUserName 'Holds the members name Dim strPassword 'Holds the user password Dim strUsersSalt 'Holds the salt value for ecrypted passwords Dim strOldPassword 'Holds the old password for the user Dim strOldSalt 'Holds the salt value for the old password Dim strOldPasswordInput 'Holds the old password the user has entered Dim blnHTMLformat 'Set to true if email is to be in HTML format Dim blnEmailOK 'Set to true if the email address is valid Dim lngMemberID 'Holds the members ID number Dim laryCatID 'Holds the cat ID Dim blnChecked 'Set to true if the category checkbox is to be checked Dim blnConfirmPassOK 'Set to true if the old password matches the confirmed pass Dim blnUpadteEmailAddr 'Set to true if updating the users email address Dim blnUpdatePass 'Set to true if the password is updated Dim strSubject 'Holds the subject of te email Dim strEmailBody 'Holds the email body Dim strUserID 'Holds the users ID 'Initialise variables blnEmailOK = True blnConfirmPassOK = True lngMemberID = 0 blnUpdatePass = false 'Read in the users ID code strUserID = Trim(Mid(Request.QueryString("ID"), 1, 22)) 'Clean up the USER ID address getting rid of unwanted characters strUserID = IDcharacterStrip(strUserID) 'Get the users details from the database If NOT strUserID = "" Then 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "SELECT " & strDbTable & "Members.* " & _ "FROM " & strDbTable & "Members " & _ "WHERE " & strDbTable & "Members.ID_Code = '" & strUserID & "';" With rsCommon 'Set the cursor type property of the record set to Dynamic so we can navigate through the record set .CursorType = 2 'Set the Lock Type for the records so that the record set is only locked when it is updated .LockType = 3 'Query the database .Open strSQL, adoCon 'If a record is found read in the details If NOT .EOF Then 'Get the email address lngMemberID = .Fields("Mail_ID") strUserName = .Fields("Name") strOldEmail = .Fields("Email") strOldPassword = .Fields("Password") strOldSalt = .Fields("Salt") blnHTMLformat = CBool(.Fields("HTMLformat")) End If End With 'If the user code is not enterd or does not match bounce the user to the login page Else 'Clean up Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing 'Redirect to login page Response.Redirect("default.asp") end if 'Read in the form details If Request.Form("postBack") Then 'Read in the email address strEmail = Trim(Mid(LCase(Request("email")), 1, 35)) 'Clean up the email address address getting rid of unwanted characters strEmail = characterStrip(strEmail) 'Check to see if the user has entered an e-mail address and that it is a valid address If Len(strEmail) < 5 OR NOT Instr(1, strEmail, " ") = 0 OR InStr(1, strEmail, "@", 1) < 2 OR InStrRev(strEmail, ".") < InStr(1, strEmail, "@", 1) Then 'Set an error message if the users has not enetered a valid e-mail address blnEmailOK = False 'Else the email address is OK Else blnEmailOK = True End If 'Read in the form details strUserName = removeAllTags(Trim(Mid(Request.Form("name"), 1, 25))) strPassword = removeAllTags(Trim(Mid(Request.Form("password"), 1, 25))) strOldPasswordInput = removeAllTags(Trim(Mid(Request.Form("oldPassword"), 1, 25))) If blnPlainTextOption = true Then blnHTMLformat = CBool(Request.Form("HTMLformat")) Else blnHTMLformat = true End If 'If this is a post back run update code If Request.Form("postBack") AND blnEmailOK AND strUserName <> "" Then 'Check the password if the user is updating their password If strPassword <> "" Then 'If the passwords are encrypted first encrypt the password If blnEncryptPasswords Then strOldPasswordInput = HashEncode(strOldPasswordInput & strOldSalt) 'Check the old password is correct If strOldPasswordInput = strOldPassword Then 'If the password is to be encrypted then do so If blnEncryptPasswords Then 'Create a new salt value strUsersSalt = hexValue(Len(strPassword)) 'Encrypt the password strPassword = HashEncode(strPassword & strUsersSalt) 'Update the recordset rsCommon.Fields("Salt") = strUsersSalt End If 'Update recordset with new password rsCommon.Fields("Password") = strPassword 'Set the conformed pass is OK blnConfirmPassOK = True blnUpdatePass = True 'Else the conirmed pass doesn't match the old one Else blnConfirmPassOK = false End If End If 'Check to see if the email address is being updated 'If the email address are the same the email is not being updated If strOldEmail = strEmail Then blnUpadteEmailAddr = false 'The email address is being updated Else blnUpadteEmailAddr = true strOldEmail = strEmail End If 'Update the database If blnConfirmPassOK Then 'Set database fields rsCommon.Fields("Name") = strUserName If blnUpadteEmailAddr Then rsCommon.Fields("Email") = strEmail If blnActivate AND blnUpadteEmailAddr Then rsCommon.Fields("Active") = False rsCommon.Fields("HTMLformat") = blnHTMLformat 'Update the database rsCommon.Update 'Delete category details from the database before the update strSQL = "DELETE FROM " & strDbTable & "MemCat WHERE " & strDbTable & "MemCat.Mail_ID=" & lngMemberID & ";" 'Write to database adoCon.Execute(strSQL) 'Add the category details to the database For each laryCatID in Request.Form("catID") 'Add cat choices strSQL = "INSERT INTO " & strDbTable & "MemCat " & _ "(" & _ "[Mail_ID], " & _ "[Cat_ID] " & _ ") " & _ "VALUES " & _ "('" & lngMemberID & "', " & _ "'" & CLng(laryCatID) & "' " & _ ")" 'Write to database adoCon.Execute(strSQL) Next 'If email activation is enabled then the user will need to re-activate their account so send email If blnActivate AND blnUpadteEmailAddr Then 'Set the subject of the email strSubject = strWebsiteName & ": Re-Confirm Your Subscription To Mailing List" 'set the message body of the activation email strEmailBody = "Hi " & strUserName & "," & _ vbCrLf & vbCrLf & "Greetings from " & strWebsiteName & "." & _ vbCrLf & vbCrLf & "You have sucessfully changed your " & strWebsiteName & " mailing list preferences." & _ vbCrLf & vbCrLf & "As your email address has been changed you will need to re-activate your subscription by clicking the address below:-" & _ vbCrLf & vbCrLf & strWebsiteAddress & "/activate.asp?M=RE&ID=" & strUserID & _ vbCrLf & vbCrLf & "If you did not subscribe or this email is in error, then please just ignore it, you need do nothing more." & _ vbCrLf & vbCrLf & "Thank-you for your interest." & _ vbCrLf & vbCrLf & "Best Regards," & _ vbCrLf & vbCrLf & strWebsiteName 'Create email object Call createMailObject(strMailComponent) '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** 'Write a remove from mailing list message to add to the end of the e-mail in HTML Format strEmailBody = strEmailBody & mailBody("text", strEmail, blnLCode) '- This needs to stay in place for the software to stay legal in most countries '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** 'Send the email Call SendMail(strUserName, strEmail, strMailComponent, "text") 'Drop email component Call dropMailObject(strMailComponent) 'Clean up rsCommon.close Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing 'Redirect to actiavtion page Response.Redirect("management_centre_update.asp?ID=" & Server.URLEncode(strUserID) & "&PU=" & blnUpdatePass & "&RA=1") 'Else send a mail letting the user know they have updated their prefences Else 'Set the subject of the email strSubject = strWebsiteName & ": Mailing List Preferences Updated" 'set the message body of the prefernce update email strEmailBody = "Hi " & strUserName & "," & _ vbCrLf & vbCrLf & "Greetings from " & strWebsiteName & "." & _ vbCrLf & vbCrLf & "You have sucessfully changed your " & strWebsiteName & " mailing list preferences." & _ vbCrLf & vbCrLf & "If you would like to change your preferences again, you may do so through the Mailing List Management Centre at the following address:-" & _ vbCrLf & strWebsiteAddress & "/default.asp?email=" & Server.URLEncode(strEmail) & _ vbCrLf & vbCrLf & "Thank-you for your interest." & _ vbCrLf & vbCrLf & "Best Regards," & _ vbCrLf & vbCrLf & strWebsiteName 'Create email object Call createMailObject(strMailComponent) '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** 'Write a remove from mailing list message to add to the end of the e-mail in HTML Format strEmailBody = strEmailBody & mailBody("text", strEmail, blnLCode) '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** 'Send the email Call SendMail(strUserName, strEmail, strMailComponent, "text") 'Drop email component Call dropMailObject(strMailComponent) 'Clean up rsCommon.close Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing 'Redirect to actiavtion page Response.Redirect("management_centre_update.asp?ID=" & Server.URLEncode(strUserID) & "&PU=" & blnUpdatePass & "&RA=0") End If End If End If 'Clean up rsCommon.close %>
Your subscription update request could not be processed. <% If blnEmailOK = false Then Response.Write("The email address you entered is not valid! Please enter a valid email address.") ElseIf strUserName = "" Then Response.Write("Please enter a valid name.") ElseIf blnConfirmPassOK = false Then Response.Write("The password entered as the present password was incorrect.") End If %> |