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

📄 register.asp

📁 简单的asp论坛源码系统,很适用于初学者!界面简洁,功能齐全
💻 ASP
📖 第 1 页 / 共 5 页
字号:
                        'Read in the email address to check
                        strCheckEmailAddress = rsCommon("Email")

                        'If a whildcard character is found then check that
                        If Instr(1, strCheckEmailAddress, "*", 1) > 0 Then

	                        'Remove the wildcard charcter from the email address to check
	                        strCheckEmailAddress = Replace(strCheckEmailAddress, "*", "", 1, -1, 1)

	                        'If the banned email and the email entered match up then don't let em sign up
	                        If InStr(1, strEmail, strCheckEmailAddress, 1) Then blnEmailBlocked = True

	                        '2nd check Use the same filters as that on the email address being checked
	        		strCheckEmailAddress = formatInput(strCheckEmailAddress)

	                        'If the banned email and the email entered match up then don't let em sign up
	                        If InStr(1, strEmail, strCheckEmailAddress, 1) Then blnEmailBlocked = True

	                'Else check the actual name doesn't match
	                Else

	                	'Use the same filters as that on the email address being checked
	        		strCheckEmailAddress = formatInput(strCheckEmailAddress)

	                        'If the banned email and the email entered match up then don't let em sign up
	                        If strCheckEmailAddress = strEmail Then blnEmailBlocked = True
	        	End If

                        'Move to the next record
                        rsCommon.MoveNext
                Loop

                'Close recordset
                rsCommon.Close


		'******************************************
		'***  Check email address is availabe	***
		'******************************************

                'If e-mail activation is on then check the email address is not already used
                If blnEmailActivation = True Then

                        'Initalise the strSQL variable with an SQL statement to query the database
                        strSQL = "SELECT " & strDbTable & "Author.Author_email " & _
                        "FROM " & strDbTable & "Author" & strDBNoLock & " " & _
                        "WHERE " & strDbTable & "Author.Author_email = '" & strEmail & "';"

                        'Query the database
                        rsCommon.Open strSQL, adoCon

                        'If there is a record returned from the database then the email address is already used
                        If NOT rsCommon.EOF Then blnEmailOK = False

                        'Close recordset
                        rsCommon.Close

                End If

		'******************************************
		'*** 	     Create a usercode 		***
		'******************************************

                'Calculate a code for the user
                strUserCode = userCode(strUsername)


	'******************************************
	'***   If update, update usercode	***
	'******************************************

        'Else this is an update so just calculate a new usercode
        Else

                'Calculate a new code for the user
                strUserCode = userCode(strLoggedInUsername)

        End If




	'******************************************
	'*** Read in user details from database ***
	'******************************************

        'Intialise the strSQL variable with an SQL string to open a record set for the Author table
        strSQL = "SELECT " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Group_ID, " & strDbTable & "Author.Username, " & strDbTable & "Author.Real_name, " & strDbTable & "Author.Gender, " & strDbTable & "Author.User_code, " & strDbTable & "Author.Password, " & strDbTable & "Author.Salt, " & strDbTable & "Author.Author_email, " & strDbTable & "Author.Homepage, " & strDbTable & "Author.Location, " & strDbTable & "Author.MSN, " & strDbTable & "Author.Yahoo, " & strDbTable & "Author.ICQ, " & strDbTable & "Author.AIM, " & strDbTable & "Author.Occupation, " & strDbTable & "Author.Interests, " & strDbTable & "Author.DOB, " & strDbTable & "Author.Signature, " & strDbTable & "Author.No_of_posts, " & strDbTable & "Author.No_of_PM, " & strDbTable & "Author.Join_date, " & strDbTable & "Author.Avatar, " & strDbTable & "Author.Avatar_title, " & strDbTable & "Author.Last_visit, " & strDbTable & "Author.Time_offset, " & strDbTable & "Author.Time_offset_hours, " & strDbTable & "Author.Date_format, " & strDbTable & "Author.Show_email, " & strDbTable & "Author.Attach_signature, " & strDbTable & "Author.Active, " & strDbTable & "Author.Rich_editor, " & strDbTable & "Author.Reply_notify, " & strDbTable & "Author.PM_notify, " & strDbTable & "Author.Skype, " & strDbTable & "Author.Login_attempt, " & strDbTable & "Author.Banned, " & strDbTable & "Author.Info, " & strDbTable & "Author.Newsletter " &_
	"FROM " & strDbTable & "Author" & strRowLock & " " & _
	"WHERE " & strDbTable & "Author.Author_ID = " & lngUserProfileID & ";"

        'Set the cursor type property of the record set to Dynamic so we can navigate through the record set
        rsCommon.CursorType = 2

        'Set the Lock Type for the records so that the record set is only locked when it is updated
        rsCommon.LockType = 3

        'Open the author table
        rsCommon.Open strSQL, adoCon




	'********************************************
	'*** Update the usercode if in admin mode ***
	'********************************************

        'If there is a record and in admin mode update the user code to activate or suspend the member
        If NOT rsCommon.EOF AND blnAdminMode Then

        	'Read in the usercode to check incase we are suspending or unsuspending the account
        	strUserCode = rsCommon("User_code")

        	'If we are suspending the user account then update the user code
        	If (blnUserActive = False OR blnSuspended) AND lngUserProfileID > 2 Then

        	 	strUserCode = userCode(strUsername)
        	End If
        End If



	'********************************************
	'*** Don't let moderator update admin mem ***
	'********************************************

        'Once the author table is open if this is an update and admin mode is on and the updater is a moderator check that the account being updated is not an admin account
        If strMode = "update" AND blnAdminMode AND blnModerator AND NOT rsCommon.EOF Then

                'If the account being updated is an admin account and the updater is only a moderator then send 'em away
                If CInt(rsCommon("Group_ID")) = 1 Then

                        'clean up before redirecting
                        rsCommon.Close
                        Call closeDatabase()

                        'redirect to insufficient permissions page
                        Response.Redirect("insufficient_permission.asp?FID=" & intForumID & strQsSID3)
                End If
        End If


	'******************************************
	'*** 		Encrypt password	***
	'******************************************

        'Encrypt password
	If blnEncryptedPasswords Then

	        If strPassword <> "" Then

	                'If this is a new reg then generate a salt value
	                If strMode = "new" Then
	                        strSalt = getSalt(Len(strPassword))

	                'Else this is an update so get the salt value from the db
	                Else
	                        strSalt = rsCommon("Salt")
	                End If

	                'Concatenate salt value to the password
	                strEncryptedPassword = strPassword & strSalt
	                strConfirmPassword = strConfirmPassword & strSalt

	                'Encrypt the password
	                strEncryptedPassword = HashEncode(strEncryptedPassword)
	                strConfirmPassword = HashEncode(strConfirmPassword)
	        End If

	'Else the password is not set to be encrypted so place the un-encrypted password into the strEncryptedPassword variable
	Else

		strEncryptedPassword = strPassword
	End If




	'******************************************
	'*** 		Update password		***
	'******************************************

	'If this is an update then check the user has not change their password
	If strMode = "update" AND strPassword <> "" Then

	      	'Check the old password matches that of the confirmed password
	        If strConfirmPassword <> rsCommon("Password") AND blnAdminMode = false Then blnConfirmPassOK = false


		'If the password doesn't match that stored in the db then this is a password update
	        If rsCommon("Password") <> strEncryptedPassword AND blnConfirmPassOK Then

			'If encrypted passwords
			If blnEncryptedPasswords Then 
		                
		                'Generate new salt
		                 strSalt = getSalt(Len(strPassword))
	
		         	'Concatenate salt value to the password
		           	strEncryptedPassword = strPassword & strSalt
	
		         	'Re-Genreate encypted password with new salt value
		            	strEncryptedPassword = HashEncode(strEncryptedPassword)
		        
		        'Else if not using encrypted passwords
		        Else
		        	strEncryptedPassword = strPassword
			End If

	                'Set the changed password boolean to true
	                If blnDemoMode = False Then blnPasswordChange = True
	        End If
	  End If





	'******************************************
	'*** 	  Check for email update	***
	'******************************************

        'If e-mail activation is on then check the user has not changed there e-mail address
        If blnEmailActivation AND blnAdmin = False AND (strMode = "update" AND (intUpdatePartNumber = 1 OR intUpdatePartNumber = 0)) Then

                'If the old and new e-mail addresses don't match set the reactivation boolean to true
                If rsCommon("Author_email") <> strEmail Then blnAccountReactivate = True
        End If




	'******************************************
	'*** 	  	Update datbase		***
	'******************************************

        'If this is new reg and the username and email is OK or this is an update then register the new user or update the rs
        If (strMode = "new" AND blnUsernameOK AND blnEmailOK AND blnSecurityCodeOK AND blnEmailBlocked = False) OR (strMode = "update" AND blnConfirmPassOK) Then


                'If this is new then create a new rs and reset session variable
                If strMode = "new" Then rsCommon.AddNew


                'Insert the user's details into the rs
                With rsCommon

                        If strMode = "new" Then
                        	.Fields("Username") = strUsername
				.Fields("Group_ID") = intForumStartingGroup
				.Fields("Join_date") = internationalDateTime(Now())
				.Fields("Last_visit") = internationalDateTime(Now())
				.Fields("Banned") = False
				.Fields("Info") = "" 'This is to prevent errors in mySQL
				.Fields("No_of_posts") = 0
				.Fields("No_of_PM") = 0
				.Fields("Login_attempt") = 0
			End If



                        'If part number = 0 (all) or part 1 (reg details) then run this code
                        If intUpdatePartNumber = 0 OR intUpdatePartNumber = 1 Then

	                        If (strMode = "update" AND blnPasswordChange = True) OR  strMode = "new" Then .Fields("Password") = strEncryptedPassword
	                        If (strMode = "update" AND blnPasswordChange = True) OR  strMode = "new" Then .Fields("Salt") = strSalt
	                        If blnWindowsAuthentication = False Then .Fields("User_code") = strUserCode
	                        .Fields("Author_email") = strEmail
	                End If




                        'If part number = 0 (all) or part 2 (profile details) then run this code
                        If intUpdatePartNumber = 0 OR intUpdatePartNumber = 2 Then

		             	.Fields("Real_name") = strRealName
		        	.Fields("Gender") = strGender
		        	.Fields("Location") = strLocation
		       		.Fields("Avatar") = strAvatar


		                'If this is new reg then don't include profile info in the add new
                        	If (blnLongRegForm AND strMode = "new") OR strMode <> "new" Then

		                        .Fields("Homepage") = strHomepage
		                        .Fields("ICQ") = strICQNum
		                        .Fields("AIM") = strAIMAddress
		                        .Fields("MSN") = strMSNAddress
		                        .Fields("Yahoo") = strYahooAddress
		                        .Fields("Skype") = strSkypeName
		                        .Fields("Occupation") = strOccupation
		                        .Fields("Interests") = strInterests
		                        .Fields("DOB") = dtmDateOfBirth
		                        .Fields("Signature") = strSignature
		                        .Fields("Attach_signature") = blnAttachSignature
	                	Else
	                		.Fields("Attach_signature") = true
	                	End If
                	End If

⌨️ 快捷键说明

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