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

📄 register.asp

📁 简介:一个程序小巧而功能强大
💻 ASP
📖 第 1 页 / 共 2 页
字号:
	strAIM = sql_encode(request.form("AIM"))
	strBiography = clean_text(request.form("Biography"), 0)
	strSignature = clean_text(bbcode(request.form("Signature"), 0), 0)
	strOnlineView = request.form("Invisible")
	strEmailView = request.form("ShowEmail")
	strAdminEmail = request.form("AdminEmail")
	if Site_Account_Verification = 1 then
		strStatus = 0
	else
		strStatus = 1
	end if
		
	if request.form("submit") <> "Complete" and instr(1, strReferer, Site_Home_URL, 1) <> 0 then
		response.redirect(Site_Forum_URL & "register.asp?Action=Register")
	else
		if request.form("Email") = request.form("Email2") and request.form("Password") = request.form("Password2") and len(request.form("Password")) > 3 and len(request.form("Email")) > 6 then
			'Check that the username and email address aren't already in use
			set rsPreregister = server.createobject("adodb.recordset")
			sqlPreregister = "SELECT * FROM Forum_Users WHERE User_Name = '"& request.form("Username") &"' OR User_Email = '"& request.form("Email") &"'"
			rsPreregister.open sqlPreregister, adoConn
			
			if rsPreregister.eof then
				rsPreregister.close
				set rsPreregister = nothing
				
				'Add user to the database
				set rsRegister = server.createobject("adodb.recordset")
				sqlRegister = "SELECT * FROM Forum_Users"
				rsRegister.cursortype = 2
				rsRegister.locktype = 3
				rsRegister.open sqlRegister, adoConn
				rsRegister.addnew
				rsRegister("User_Name") = strUsername
				rsRegister("User_Email") = strEmail
				rsRegister("User_Password") = strPassword
				rsRegister("User_Join_Date") = Site_Time
				rsRegister("User_Laston_Date") = Site_Time
				rsRegister("User_LastURL") = "default.asp"
				rsRegister("User_Signature") = strSignature
				rsRegister("User_Location") = strLocation
				rsRegister("User_ICQ") = strICQ
				rsRegister("User_MSN") = strMSN
				rsRegister("User_AIM") = strAIM
				rsRegister("User_Website") = strWebsite
				rsRegister("User_Biography") = strBiography				
				rsRegister("User_Status") = strStatus
				if request.form("Invisible") = 1 then
					rsRegister("User_Online_View") = 0
				else
					rsRegister("User_Online_View") = 1
				end if
				if strDOB <> "" then
					rsRegister("User_DOB") = strDOB
				end if
				if request.form("ShowEmail") = 1 then
					rsRegister("User_Email_View") = 1
				else
					rsRegister("User_Email_View") = 0
				end if
				if request.form("AdminEmail") = 1 then
					rsRegister("User_Admin_Email") = 1
				else
					rsRegister("User_Admin_Email") = 0
				end if
				rsRegister("User_Activation") = strActivationCode
				rsRegister("User_IP") = strIPAddress
				rsRegister.update
				rsRegister.close
				set rsRegister = nothing
					
				'Get the new User_ID
				set rsEmail = server.createobject("adodb.recordset")
				sqlEmail = "SELECT @@IDENTITY AS NewID"
				rsEmail.open sqlEmail, adoConn
				strUserID = rsEmail("NewID")
				rsEmail.close
				set rsEmail = nothing
			
				'Construct E-Mail
				emailTo = request.form("email")
				emailFrom = "Accounts" & "<" & Site_Email_Address & ">"
				emailSubject = Site_Name & " Account"
				emailBody = "Hello " & request.form("username") & "<br><br>Congratulations on signing up to the " & Site_Name & " forum. Before we can activate your account one last step must be taken to complete your registration.<br><br>Please note - This step must be completed for you to become a registered member.<br><br>To complete your registration please click on the link below:<br><a href=""" & Site_Forum_URL & "/register.asp?Action=Activate&U="& strUserID &"&A="& strActivationCode &""">" & Site_Forum_URL & "/register.asp?Action=Activate&U="& strUserID &"&A="& strActivationCode &"</a>.<br><br>Kind Regards<br><br>" & Site_Email_Signature
					
				'Send Email using e-mail include
				if Site_Account_Verification = 1 then
					%>
					<!--#include file="Includes/inc-email.asp" -->
					<%
				end if

				'Update forum stats
				set rsStats = server.createobject("adodb.recordset")
				sqlStats = "SELECT * FROM Forum_Stats"
				rsStats.cursortype = 2
				rsStats.locktype = 3
				rsStats.open sqlStats, adoConn
				rsStats("Stats_Users") = rsStats("Stats_Users") + 1
				rsStats("Stats_User_ID") = strUserID
				rsStats("Stats_User_Name") = strUsername
				rsStats.update
				rsStats.close
				set rsStats = nothing
				
				'Display confirmation message
				strRedirectURL = "default.asp"
				%>
				<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="main">
					<tr valign="middle" class="title">
					<td align="center"><%=Site_Name%> // Registration Complete</td>
					</tr>
					<tr class="body">
					<td align="center">
					<%
					if Site_Account_Verification = 1 then
					%>
						Congratulations, your <%=Site_Name%> Forums account creation is almost complete. An e-mail has been sent to <%=request.form("Email")%> with instructions of how to complete your account creation. Click <a href="default.asp">here</a> to return to the site.
						<br>
						<br>
						Regards the ASP Forums Team.
					<%
					else
					%>
						Congratulations, your <%=Site_Name%> Forums account creation is complete and you may now log in with your chosen details. Click <a href="default.asp">here</a> to return to the site.
						<br>
						<br>
						Regards the ASP Forums Team.
					<%
					end if
					%>
					</td>
					</tr>
				</table>	
				<%
				
			else		
				'Username or Email address is already in use		
				'Determine error message
				if rsPreregister("User_Name") = request.form("Username") then
					strMessage = "The username that you have selected is already in use, please try another name"
				end if
				if rsPreregister("User_Email") = request.form("Email") then
					strMessage = "The Email address that you have entered is already in use. If you have forgotten your password please use the password reminder function."
				end if
				rsPreregister.close
				set rsPreregister = nothing
				strRedirectURL = "javascript:history.go(-1)"
				%>
				<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="main">
					<tr valign="middle" class="title">
					<td align="center"><%=Site_Name%> // Registration Failed</td>
					</tr>
					<tr class="body">
					<td align="center">
					Unfortunately your <%=Site_Name%> Forums registration failed for the following reason: <%=strMessage%>. Please <a href="javascript:history.go(-1)"  onMouseOver="self.status=document.referrer;return true">Try Again</a>
					</td>
					</tr>
				</table>
				<%
				response.write("<META HTTP-EQUIV=""Refresh"" CONTENT=""5; URL=" & strRedirectURL & """>")
			end if
		else
			'The users inputted Email address and or passwords do not match or date of birth has not been entered
			if request.form("Email") <> request.form("Email2") then
				strMessage = "The e-mail addresses that you entered do not match."
			end if
			if request.form("Password") <> request.form("Password2") then
				strMessage = "The passwords that entered do not match."
			end if
			if len(request.form("Password")) < 3 then
				strMessage = "Your chosen password must be greater than three characters in length"
			end if
			if len(request.form("Email")) < 6 then
				strMessage = "The e-mail address that you have entered is not valid"
			end if
			strRedirectURL = "javascript:history.go(-1)"
			%>
			<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="main">
				<tr valign="middle" class="title">
				<td align="center"><%=Site_Name%> // Registration Failed</td>
				</tr>
				<tr class="body">
				<td align="center">
				Unfortunately your <%=Site_Name%> Forums registration failed for the following reason: <%=strMessage%>. Please <a href="javascript:history.go(-1)"  onMouseOver="self.status=document.referrer;return true">Try Again</a>
				</td>
				</tr>
			</table>
			<%
		end if
		response.write("<META HTTP-EQUIV=""Refresh"" CONTENT=""5; URL=" & strRedirectURL & """>")
	end if	
end if
		
if Action = "Activate" then

	strUser = int(request.querystring("U"))
	strCode = int(request.querystring("A"))
	
	set rsActivate = server.createobject("adodb.recordset")
	sqlActivate = "SELECT * FROM Forum_Users WHERE User_ID = "& strUser &" AND User_Activation = "& strCode &""
	rsActivate.cursortype = 2
	rsActivate.locktype = 3
	rsActivate.open sqlActivate, adoConn, CMDText
	if not (rsActivate.eof or rsActivate.bof) then
		'set user session variables
		session("UserID") = rsActivate("User_ID")
		session("UserName") = rsActivate("User_Name")
		session("laston") = rsActivate("User_Laston_Date")
			
		response.cookies(site_name)("read") = "r"
		
		'Write last on date to cookie
		response.cookies(site_name)("laston") = db_time()
			
		'Update database
		rsActivate("User_Status") = 1
		if request.servervariables("HTTP_X_FORWARDED_FOR") = "" then
			rsActivate("User_IP") = request.servervariables("REMOTE_ADDR")
		else
			rsActivate("User_IP") = request.servervariables("HTTP_X_FORWARDED_FOR")
		end If
		rsActivate("User_Laston_Date") = Site_Time
				
		strHeader = "Activation Success"
		strMessage = "Congratulations your "& Site_Name &" account registration was successfull you will now be able to log in to the site with your chosen details. Please click <a href='/default.asp'>here</a> if you are not redirected within five seconds."
		strRedirectURL = "default.asp"
	else
		strHeader = "Activation Failed"
		strMessage = "Unfortunately there was a problem with your account registration, please check your activation e-mail and try again. If you followed a valid registration link and you are still getting this message please contact <a href='mailto:'"& Site_Email_Address &"'>"& Site_Email_Address &"</a>"
		strRedirectURL = "default.asp"
	end if
	rsActivate.update
	rsActivate.close
	set rsActivate = nothing
	%>
	<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="main">
		<tr valign="middle" class="title">
		<td align="center"><%=Site_Name%> // Account Activated</td>
		</tr>
		<tr class="body">
		<td align="center">
		<%=strMessage%>
		</td>
		</tr>
	</table>
	<META HTTP-EQUIV="Refresh" CONTENT="5; URL=<%=strRedirectURL%>">
	<%
end if

if Action = "Member" then
%>
	<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="main">
		<tr valign="middle" class="title">
		<td align="center"><%=Site_Name%> // Account Error</td>
		</tr>
		<tr class="body">
		<td align="center">
		你已经是 <%=Site_Name%> 的会员. Please click <a href="<%=Site_Forum_URL%>">here</a> to return to the forums.
		</td>
		</tr>
	</table>
	<META HTTP-EQUIV="Refresh" CONTENT="5; URL=default.asp">
<%
end if

if Action = "Disabled" then
%>
	<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="main">
		<tr valign="middle" class="title">
		<td align="center"><%=Site_Name%> // Account Creation Disabled</td>
		</tr>
		<tr class="body">
		<td align="center">
		Account registration is currently disabled for the <%=Site_Name%> forums and they are not taking any sign-ups at this time. Please click <a href="<%=Site_Forum_URL%>">here</a> to return to the forums.
		</td>
		</tr>
	</table>
	<META HTTP-EQUIV="Refresh" CONTENT="5; URL=default.asp">
<%
end if
%>
<!--#include file="Includes/inc-footer.asp" -->
</body>
</html>

⌨️ 快捷键说明

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