⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 register.asp

📁 简单的asp论坛源码系统,很适用于初学者!界面简洁,功能齐全
💻 ASP
📖 第 1 页 / 共 5 页
字号:



                        'If part number = 0 (all) or part 3 (forum preferences) then run this code
                        If intUpdatePartNumber = 0 OR intUpdatePartNumber = 3 Then

	                        .Fields("Date_format") = strDateFormat
	                        .Fields("Time_offset") = strTimeOffSet
	                        .Fields("Time_offset_hours") = intTimeOffSet
	                        .Fields("Reply_notify") = blnReplyNotify
	                        .Fields("Rich_editor") = blnWYSIWYGEditor
	                        .Fields("PM_notify") = blnPMNotify
	                        .Fields("Show_email") = blnShowEmail
	                        If blnWebWizNewsPad Then .Fields("Newsletter") = blnNewsletter
	                End If




                        'If the e-mail activation is on and this is a new reg or an update and the account needs reactivating then don't activate the account
                        If (((blnEmailActivation OR blnMemberApprove) AND strMode = "new") OR blnAccountReactivate) AND blnModerator = False Then
                                .Fields("Active") = False
                        Else
                                .Fields("Active") = True
                        End If




                        'If the admin mode is enabled then the admin can also update some other member parts
                        If blnAdminMode AND (blnAdmin Or blnModerator) AND strMode = "update" AND blnDemoMode = False Then

                        	If lngUserProfileID > 2 Then .Fields("Active") = blnUserActive

                        	.Fields("Avatar_title") = strMemberTitle
				.Fields("Banned") = blnSuspended
				.Fields("Info") = strAdminNotes

				If isEmpty(lngPosts) = False Then .Fields("No_of_posts") = lngPosts

                        	'If the user is also the admin then let them update some other parts
                        	If blnAdmin AND lngUserProfileID > 2 Then
                        		.Fields("Group_ID") = intUsersGroupID
                		End If
                        End If

			
			'Set error trapping
			On Error Resume Next

                        'Update the database with the new user's details (needed for MS Access which can be slow updating)
                        .Update
                        
                        'If an error has occurred write an error to the page
			If Err.Number <> 0 AND strMode = "new" Then 
				Call errorMsg("An error has occurred while writing to the database.", "register_USR", "register.asp")
			ElseIf Err.Number <> 0 Then
				Call errorMsg("An error has occurred while writing to the database.", "update_USR", "register.asp")
			End If

			'Disable error trapping
			On Error goto 0

                        'Re-run the query (required for Access to give it time to update on slower servers)
                        .Requery

	                 'Close rs
	                 .Close
                End With



		'******************************************
		'*** 	     Create usercode cookie	***
		'******************************************

                'Write a cookie with the User ID number so the user logged in throughout the forum
                'But only if not in admin modem and using all parts of part 1 of the reg form
                If (blnAdminMode = False) AND (intUpdatePartNumber = 0 OR intUpdatePartNumber = 1) AND blnWindowsAuthentication = False Then

                        'Write the cookie with the name Forum containing the value UserID number
   			
   			Call saveSessionItem("UID", strUserCode)

                        'Auto Login cookie
                        If blnAutoLogin Then
                                Call setCookie("sLID", "UID", strUserCode, True)
                        'Temp Cookie
                        Else
                        	Call setCookie("sLID", "UID", strUserCode, False)
                        End If
                End If




		'******************************************
		'*** 	   Send activate email   	***
		'******************************************

                'Inititlaise the subject of the e-mail that may be sent in the next if/ifelse statements
                strSubject = strTxtWelcome & " " & strTxtEmailToThe & " " & strMainForumName

                'If the members account needs to be activated or reactivated then send the member a re-activate mail a redirect them to a page to tell them there account needs re-activating
                If ((blnEmailActivation OR blnMemberApprove) AND strMode = "new") OR blnAccountReactivate Then


                	'If new registration we need to get the new users ID from the database
                	If strMode = "new" Then
	                       
	                        'SQL to get the new Author_ID from the database
				strSQL = "SELECT " & strDBTop1 & " " & strDbTable & "Author.Author_ID " & _
				"FROM " & strDbTable & "Author" & strDBNoLock & " " & _
				"ORDER BY " & strDbTable & "Author.Author_ID DESC" & strDBLimit1 & ";"

				'Query database
				rsCommon.Open strSQL, adoCon

	                        'Read back in the user ID for the activation email
	                        lngUserProfileID = CLng(rsCommon("Author_ID"))

	                        'Close rs
	                        rsCommon.Close
	                End If



       
                       'If the admin needs to apporove the member send the activation email to the forum admin
                        If blnMemberApprove Then
                        
                        	'Create admin activation email
	                        strEmailBody = strTxtHi & ", " & _
	                        vbCrLf & vbCrLf & strTxtEmailNewUserRegistered & " " & strMainForumName & "." & _
	                        vbCrLf & vbCrLf & "----------------------------" & _
	                        vbCrLf & strTxtUsername & ": - " & decodeString(strUsername) & _
	                        vbCrlf & strTxtEmailAddress & ": - " & strEmail & _
	                        vbCrLf & strTxtIPLogged & ": - " & getIP() & _	
	                        vbCrLf & "----------------------------" & _
	                        vbCrLf & vbCrLf & strTxtToActivateTheNewMembershipFor & " " & decodeString(strUsername) & " " & strTxtForumClickOnTheLinkBelow & ": -" & _
	                        vbCrLf & vbCrLf & strForumPath & "admin_activate.asp?USD=" & lngUserProfileID
	                       
                        
                        	'Send the e-mail using the Send Mail function created on the send_mail_function.inc file
                        	blnSentEmail = SendMail(strEmailBody, strTxtForumAdmin, decodeString(strForumEmailAddress), strMainForumName, decodeString(strForumEmailAddress), strTxtNewMemberActivation, strMailComponent, false)

                        	'If user has an email address send em a welcome email
                        	If blnEmail AND strEmail <> "" Then

	                        	'Initailise the e-mail body variable with the body of the e-mail
		                        strEmailBody = strTxtHi & " " & decodeString(strUsername) & _
		                        vbCrLf & vbCrLf & strTxtEmailThankYouForRegistering & " " & strMainForumName & "." & _
		                        vbCrLf & vbCrLf & strTxtEmailYouCanNowUseOnceYourAccountIsActivatedTheForumAt & " " & strWebsiteName & " " & strTxtEmailForumAt & " " & strForumPath & _
		                        vbCrLf & vbCrLf & "----------------------------" & _
	                        	vbCrLf &  strTxtUsername & ": - " & strUsername & _
		                        vbCrLf & strTxtPassword & ": - " & decodeString(strPassword) & _
		                        vbCrLf & "----------------------------"
		                        If blnEncryptedPasswords Then strEmailBody = strEmailBody & vbCrLf & vbCrLf & strTxtPleaseDontForgetYourPassword

		                        'Send the e-mail using the Send Mail function created on the send_mail_function.inc file
	                        	blnSentEmail = SendMail(strEmailBody, decodeString(strUsername), decodeString(strEmail), strMainForumName, decodeString(strForumEmailAddress), strSubject, strMailComponent, false)
	                        End If


                        'Send an email to enable the users account to be re-activated
                        ElseIf blnAccountReactivate Then
                        	
                        	'Email subject
                        	strSubject = strMainForumName & " " & strTxtActivationEmail

	                        'Create re-activate email body
	                        strEmailBody = strTxtHi & " " & decodeString(strLoggedInUsername) & _
	                        vbCrLf & vbCrLf & strTxtYourEmailHasChanged & ", " & strMainForumName & ", " & strTxtPleaseUseLinkToReactivate & "." & _
	                        vbCrLf & vbCrLf & strTxtToActivateYourMembershipFor & " " & strMainForumName & " " & strTxtForumClickOnTheLinkBelow & ": -" & _
	                        vbCrLf & vbCrLf & strForumPath & "activate.asp?ID=" & Server.URLEncode(strUserCode) & "&USD=" & lngUserProfileID

				'Send the e-mail using the Send Mail function created on the send_mail_function.inc file
                        	blnSentEmail = SendMail(strEmailBody, decodeString(strUsername), decodeString(strEmail), strMainForumName, decodeString(strForumEmailAddress), strSubject, strMailComponent, false)

			'Else send that this is a new mail account so send activation email
	 		Else

	 			'Create email activate email body
	                        strEmailBody = strTxtHi & " " & decodeString(strUsername) & _
	                        vbCrLf & vbCrLf & strTxtEmailThankYouForRegistering & " " & strMainForumName & "." & _
	                        vbCrLf & vbCrLf & "----------------------------" & _
	                        vbCrLf & strTxtUsername & ": - " & decodeString(strUsername) & _
	                        vbCrLf & strTxtPassword & ": - " & strPassword & _
	                        vbCrLf & "----------------------------" & _
	                        vbCrLf & vbCrLf & strTxtToActivateYourMembershipFor & " " & strMainForumName & " " & strTxtForumClickOnTheLinkBelow & ": -" & _
	                        vbCrLf & vbCrLf & strForumPath & "activate.asp?ID=" & Server.URLEncode(strUserCode) & "&USD=" & lngUserProfileID
	                        If blnEncryptedPasswords Then strEmailBody = strEmailBody & vbCrLf & vbCrLf & strTxtPleaseDontForgetYourPassword

				'Send the e-mail using the Send Mail function created on the send_mail_function.inc file
                        	blnSentEmail = SendMail(strEmailBody, decodeString(strUsername), decodeString(strEmail), strMainForumName, decodeString(strForumEmailAddress), strSubject, strMailComponent, false)
			End If


                        'Reset server Object
                       Call closeDatabase()

			'Redirect if admin activate
			If blnMemberApprove Then
				Response.Redirect("register_confirm.asp?TP=MACT&FID=" & intForumID & strQsSID3)
                        'Redirect the reactivate page
                        ElseIf blnAccountReactivate = True Then
                                Response.Redirect("register_confirm.asp?TP=REACT&FID=" & intForumID & strQsSID3)
                        'Redirect to the activate page
                        Else
                                Response.Redirect("register_confirm.asp?TP=ACT&FID=" & intForumID & strQsSID3)
                        End If


		'******************************************
		'*** 	   Send welcome email   	***
		'******************************************

                'Send the new user a welcome e-mail if e-mail notification is turned on and the user has given an e-mail address
                ElseIf blnEmail AND strEmail <> "" AND strMode = "new" Then

                        'Initailise the e-mail body variable with the body of the e-mail
                        strEmailBody = strTxtHi & " " & decodeString(strUsername) & _
                        vbCrLf & vbCrLf & strTxtEmailThankYouForRegistering & " " & strMainForumName & "." & _
                        vbCrLf & vbCrLf & strTxtEmailYouCanNowUseTheForumAt & " " & strWebsiteName & " " & strTxtEmailForumAt & " " & strForumPath & _
                        vbCrLf & vbCrLf & "----------------------------" & _
                        vbCrLf & strTxtUsername & ": - " & strUsername & _
                        vbCrLf & strTxtPassword & ": - " & decodeString(strPassword) & _
                        vbCrLf & "----------------------------"
                        If blnEncryptedPasswords Then strEmailBody = strEmailBody & vbCrLf & vbCrLf & strTxtPleaseDontForgetYourPassword
                        

                        'Send the e-mail using the Send Mail function created on the send_mail_function.inc file
                        blnSentEmail = SendMail(strEmailBody, decodeString(strUsername), decodeString(strEmail), strMainForumName, decodeString(strForumEmailAddress), strSubject, strMailComponent, false)
                End If


		'******************************************
		'*** 	 	 Clean up   		***
		'******************************************

                'Reset server Object
               Call closeDatabase()


		'******************************************
		'*** 	 Redirect to message page	***
		'******************************************

                'Redirect the welcome new user page
                If strMode = "new" Then
                        Response.Redirect("register_confirm.asp?TP=NEW&FID=" & intForumID & strQsSID3)
                'Redirect to the update profile page
                Else
                        Response.Redirect("register_confirm.asp?TP=UPD&FID=" & intForumID & strQsSID3)
                End If

        'Else close rs
        Else
        	rsCommon.Close
        End If
End If




'******************************************
'***         Set the page mode		***
'******************************************

'If this is a new registerant then reset the mode of the page to new
If strMode = "reg" OR strMode = "new" Then

        'set the mode to new
        strMode = "new"

'Else this is an update
Else
        strMode = "update"
End If




'******************************************
'***     Get the user details from db	***
'******************************************

'If this is a profile update get the users details to update
If strMode = "update" Then

        'Read the various forums from the database
        'Initalise the strSQL variable with an SQL statement to query the database
        strSQL = "SELECT " & strDbTable & "Author.* " & _
	"FROM " & strDbTable & "Author" & strDBNoLock & " " & _
	"WHERE " & strDbTable & "Author.Author_ID = " & lngUserProfileID

        'Query the database
        rsCommon.Open strSQL, adoCon

        'If there is no matching profile returned by the recordset then redirect the user to the main forum page
        If rsCommon.EOF Then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -