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

📄 register.asp

📁 很好的一个论坛原代码
💻 ASP
字号:
<!--#INCLUDE FILE="inc/db_inc.asp"-->
<!--#INCLUDE FILE="inc/md5_inc.asp"-->
<!--#INCLUDE FILE="inc/char_inc.asp"-->
<!--#INCLUDE FILE="header.asp"-->
<%
dim ip, strip, killip
dim StrSql, rs, StrHtml, error

StrHtml = loadtemplate("htmltop")
StrHtml = Replace(StrHtml, "{pagetitle}", loadtemplate("registertitle"))
StrHtml = Replace(StrHtml, "{forumtitle}", boardtitle)
response.write StrHtml
StrHtml = loadtemplate("pagetitle")
if request.cookies("sf")("username") = "" then
	toptext = loadtemplate("toptextguest")
else
	toptext = loadtemplate("toptextuser")
end if
toptext = toptext & loadtemplate("toptext")
StrHtml = Replace(StrHtml, "{top_text}", toptext)
StrHtml = Replace(StrHtml, "{username}", request.cookies("sf")("username"))
response.write StrHtml

' 论坛关闭
StrSql = "select * from sf_setup"
Set rs2 = Conn.Execute(StrSql)
if rs2("forumclose") = 1 then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", rs2("forumclosehint"))
response.write StrHtml
response.end
end if	

' 禁止IP访问
if rs2("killip") = 1 then
	userip = cstr(request.ServerVariables("REMOTE_ADDR"))
	killiplist = rs2("killiplist")
	if killiplist <> "" and userip <> "" then
		killip = split(killiplist, "|")
		struserip = split(userip, ".")
		i = 0
		do until i > ubound(killip)
			strkillip = split(killip(i), ".")
			bolkill = true
			if (struserip(0) <> strkillip(0)) and (strkillip(0) <> "*") then bolkill = false
			if (struserip(1) <> strkillip(1)) and (strkillip(1) <> "*") then bolkill = false
			if (struserip(2) <> strkillip(2)) and (strkillip(2) <> "*") then bolkill = false
			if (struserip(3) <> strkillip(3)) and (strkillip(3) <> "*") then bolkill = false
			if bolkill then
				StrHtml = loadtemplate("error")
				StrHtml = Replace(StrHtml, "{error_text}", rs2("killiphint"))
				response.write StrHtml
				Response.End
			end if
			i = i + 1
		loop
	end if
end if

StrHtml = loadtemplate("pagepath")
StrHtml = Replace(StrHtml, "{path_text}", "<a href=""index.asp"">" & boardtitle & "</a> &raquo; " & loadtemplate("registertitle"))
response.write StrHtml	

if rs2("regclose") = 1 then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", rs2("regclosehint"))
response.write StrHtml
response.end
end if	

step = ChkSql(request("step"))
select case step
	case "3"
		error = ""
		if regtime > 0 then
			StrSql = "select lastreg from sf_counter"
			Set rs2 = Conn.Execute(StrSql)
			StrHtml = loadtemplate("err_regtime")
			StrHtml = Replace(StrHtml, "{regtime}", regtime)
			if rs2("lastreg") > dateadd("s", -1 * regtime, now()) then error = error & "<br><li>" & StrHtml
		end if
		if len(request("username")) <2 or (not IsValidSqlValue(request("username"))) then error = error & "<br><li>" & loadtemplate("err_username")
		if request("password") = "" or len(request("password")) < 6 or request("password2") = "" or request("password") <> request("password2") then error = error & "<br><li>" & loadtemplate("err_password")
		if not IsValidEmail(request("email")) then error = error & "<br><li>" & loadtemplate("err_email")
		if error <> "" then
			StrHtml = loadtemplate("error")
			StrHtml = Replace(StrHtml, "{error_text}", error)
			response.write StrHtml
			response.end
		end if
		error = ""
		StrSql = "select userid from sf_user where email = '" & ChkSql(request("email")) & "'"
		Set rs2 = Conn.Execute(StrSql)
		if not (rs2.bof or rs2.eof) then
			StrHtml = loadtemplate("error")
			StrHtml = Replace(StrHtml, "{error_text}", loadtemplate("err_email"))
			response.write StrHtml
			response.end
		end if
		StrSql = "select userid from sf_user where username = '" & ChkSql(request("username")) & "'"
		Set rs2 = Conn.Execute(StrSql)
		if not (rs2.bof or rs2.eof) then
			StrHtml = loadtemplate("error")
			StrHtml = Replace(StrHtml, "{error_text}", loadtemplate("err_chkusername"))
			response.write StrHtml
			response.end
		end if
		sex = request("sex")
		if sex <> "1" and sex <> "2" then sex = "0"
		StrSql = "insert into sf_user(username, password, email, usergroup, homepage, qq, [like], sex, country, signature, showemail,invisible, usertitle, joindate, lastvisit, lastactivity, lastposttime, lastpostid, lastposttitle, posts, avatar, defineavatar, avatarwidth, avatarheight, birthday, ipaddress, rating) values("
		StrSql = StrSql & "'" & ChkSql(request("username")) & "', "
		StrSql = StrSql & "'" & md5(ChkSql(request("password"))) & "', "
		StrSql = StrSql & "'" & ChkSql(request("email")) & "', "
		StrSql = StrSql & "0, '', '', '', " & sex & ", '', '', 1, 0, '', '" & now() & "', '" & now() & "', '" & now() & "', '" & now() &"', 0, '', 0, '1.gif', '', 0, 0, '1900-01-01', '" & cstr(request.ServerVariables("REMOTE_ADDR")) & "', 0)"
		Conn.Execute(StrSql)
		StrSql = "select top 1 userid from sf_user order by userid DESC"
		Set rs2 = Conn.Execute(StrSql)
		if not (rs2.bof or rs2.eof) then
			StrSql = "update sf_counter set usernum = usernum + 1, lastuser = '" & ChkSql(request("username")) & "', lastuserid = " & rs2("userid") & ", lastreg = '" & now() & "'"
			Conn.Execute(StrSql)
		end if
		StrHtml = loadtemplate("hint")
		StrHtml = Replace(StrHtml, "{hint_text}", loadtemplate("hint_registered"))
		StrHtml = Replace(StrHtml, "{pro_name}", "login.asp")
		response.write StrHtml
	case "2"
		response.write loadtemplate("registerstep2")
                response.write sfcopyright
	case else
		StrHtml = loadtemplate("registerstep1")
		StrHtml = Replace(StrHtml, "{reg_hint}", server.htmlencode(reghint))
		response.write StrHtml
                response.write sfcopyright
end select
response.write loadtemplate("htmlbottom")
Conn.Close
Set Conn = nothing
Set rs = nothing
Set rs2 = nothing
set ip = nothing
set strip = nothing
set killip = nothing
%>

⌨️ 快捷键说明

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