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

📄 editforum.asp

📁 很好的一个论坛原代码
💻 ASP
字号:
<%
if not session("sfadmin") then response.redirect("welcome.asp")
%>
<!--#INCLUDE FILE="../inc/db_inc.asp"-->
<!--#INCLUDE FILE="../inc/md5_inc.asp"-->
<!--#INCLUDE FILE="../inc/char_inc.asp"-->

<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK rel="stylesheet" href="image/style.css" type="text/css">
</HEAD>

<BODY bgcolor="#FFFFFF" text="#000000" leftmargin="10" topmargin="10">

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open StrConn
%>
<!--#INCLUDE FILE="checkadmin.asp"-->
<%

if request("step") = "2" then

	errstr = ""
	
	title = ChkSql(request("title"))

	if IsNumeric(request("cateid")) then
		cateid = clng(request("cateid"))
	else
		errstr = errstr & "<LI>分类参数不能为空<BR>"
	end if

	if IsNumeric(request("forumid")) then
		forumid = clng(request("forumid"))
	else
		errstr = errstr & "<LI>forumid参数不能为空<BR>"
	end if

	if IsNumeric(request("displayorder")) then
		displayorder = clng(request("displayorder"))
	else
		errstr = errstr & "<LI>显示序号参数不能为空且必须为整数<BR>"
	end if

	if IsNumeric(request("daysprune")) then
		daysprune = clng(request("daysprune"))
	else
		errstr = errstr & "<LI>显示日期范围参数不能为空且必须为整数<BR>"
	end if

	active = 0
	if request("active") = "1" then active = 1

	allowposting = 0
	if request("allowposting") = "1" then allowposting = 1
	
	canpostpoll = 0
	if request("canpostpoll") = "1" then canpostpoll = 1
	
	onlyuser = 0
	if request("onlyuser") = "1" then onlyuser = 1

	onlymember = 0
	if request("onlymember") = "1" then onlymember = 1

	allowbbcode = 0
	if request("allowbbcode") = "1" then allowbbcode = 1

	allowimages = 0
	if request("allowimages") = "1" then allowimages = 1

	allowuploadfile = 0
	if request("allowuploadfile") = "1" then allowuploadfile = 1

	canmove = 0
	if request("canmove") = "1" then canmove = 1

	canpostpoll = 0
	if request("canpostpoll") = "1" then canpostpoll = 1
	
	canopenclose = 0
	if request("canopenclose") = "1" then canopenclose = 1

	candeletepost = 0
	if request("candeletepost") = "1" then candeletepost = 1

	canreply = 0
	if request("canreply") = "1" then canreply = 1

	caneditpost = 0
	if request("caneditpost") = "1" then caneditpost = 1

	if request("moder") <> "" then
		moderarray =  split(ChkSql(request("moder")), ",")
		j = ubound(moderarray)
		if j > 50 then
			errstr = errstr & "<LI>单个版块的版主人数不得超过50<BR>"
		else
			dim moderidarray(50)
			for i = 0 to j
				Set rs = Conn.Execute("select userid from sf_user where username = '" & moderarray(i) & "'")
				if rs.bof or rs.eof then
					errstr = errstr & "<LI>用户 " &  moderarray(i) & " 不存在<BR>"
				else
					moderidarray(i) = rs("userid")
				end if
			next
		end if
	end if

	if errstr = "" then
		Conn.Execute("delete from sf_moderator where forumid=" & forumid)
		if request("moder") <> "" then
			for i = 0 to j
				Conn.Execute("insert into sf_moderator(forumid, userid, username, super, isadmin) values(" & forumid & "," & moderidarray(i) & ", '" & moderarray(i) & "', 0, 0)")
				Conn.Execute("update sf_user set usergroup = 2 where userid = " & moderidarray(i) & " and usergroup < 2")
			next
		end if
		strsql = "update sf_forum set cateid=" & cateid & ",title='" & title & "',description='" & ChkSql(request("description")) & "',"
		strsql = strsql & "displayorder=" & displayorder & ","
		strsql = strsql & "allowuploadfile=" & allowuploadfile & ",allowposting=" & allowposting & ",daysprune=" & daysprune & ","
		strsql = strsql & "allowbbcode=" & allowbbcode & ",allowimages=" & allowimages & ",canmove=" & canmove & ",canopenclose=" & canopenclose & ",canreply=" & canreply & ",caneditpost=" & caneditpost & ",candeletepost=" & candeletepost & ",canpostpoll=" & canpostpoll & ",onlyuser=" & onlyuser & ",onlymember=" & onlymember & ", memberlist='"
		strsql = strsql & ChkSql(request("memberlist")) & "' where forumid=" & forumid
		Conn.Execute(StrSql)
%>
<TABLE width="100%" border="0" cellspacing="1" cellpadding="4" align="center">
  <TR> 
    <TD bgcolor="#D1E3BF" align="center">编辑版块 <%= title %> 完毕</TD>
  </TR>
</TABLE>
<%
	end if

else
	StrSql = "select forumid, userid, username from sf_moderator where forumid = " & request("id")
	Set rs = Conn.Execute(StrSql)
	moderstr = ""
	if not(rs.bof or rs.eof) then
		do until rs.eof
			if rs("forumid") = cint(request("id")) then moderstr = moderstr &  rs("username") & ","
			rs.MoveNext
		loop
	end if
	if moderstr <> "" then moderstr = left(moderstr, len(moderstr) - 1)
	StrSql = "select * from sf_forum where forumid=" & request("id")
	Set rs = Conn.Execute(StrSql)

	cateid = rs("cateid")

	titlestr = server.htmlencode(rs("title"))
	
	if rs("description") <> "" then
		descriptionstr = server.htmlencode(rs("description"))
	else
		descriptionstr = ""
	end if

	poststr = ""
	if rs("allowposting") = 1 then poststr = " checked"
	bbcodestr = ""
	if rs("allowbbcode") = 1 then bbcodestr = " checked"
	imagestr = ""
	if rs("allowimages") = 1 then imagesstr = " checked"
	uploadstr = ""
	if rs("allowuploadfile") = 1 then uploadstr = " checked"
	movestr = ""
	if rs("canmove") = 1 then movestr = " checked"
	pollstr = ""
	if rs("canpostpoll") = 1 then pollstr = " checked"
	openstr = ""
	if rs("canopenclose") = 1 then openstr = " checked"
	deletestr = ""
	if rs("candeletepost") = 1 then deletestr = " checked"
	replystr = ""
	if rs("canreply") = 1 then replystr = " checked"
	editstr = ""
	if rs("caneditpost") = 1 then editstr = " checked"
	userstr = ""
	if rs("onlyuser") = 1 then userstr = " checked"
	memberstr = ""
	if rs("onlymember") = 1 then memberstr = " checked"
%>
<FORM name="form1" method="post" action="editforum.asp">
  <TABLE width="100%" border="0" cellspacing="1" cellpadding="4" align="center">
    <TR> 
      <TD bgcolor="#D1E3BF" align="center" colspan="2"><B>编辑论坛:</B> <% =rs("title") %></TD>        
    </TR>        
    <TR>         
      <TD width="30%">&nbsp;</TD>        
      <TD>&nbsp;</TD>        
    </TR>        
    <TR>         
      <TD bgcolor="#E4EEDB">名称</TD>        
      <TD bgcolor="#E4EEDB">         
        <INPUT type="text" name="title" size="30" maxlength="100" value="<% =titlestr %>">        
      </TD>        
    </TR>        
    <TR>         
      <TD>说明</TD>        
      <TD>         
        <INPUT type="text" name="description" size="50" maxlength="250" value="<% =descriptionstr %>">        
      </TD>        
    </TR>        
    <TR bgcolor="#F5F5F5">         
      <TD>所属分类</TD>        
      <TD>         
<%        
	StrSql = "select cateid, catetitle from sf_cate order by displayorder DESC, cateid ASC"        
	Set rs4 = Conn.Execute(StrSql)        
	if not(rs4.bof or rs4.eof) then        
		response.write "<select name=""cateid"">"        
		do until rs4.eof        
			response.write "<option value=""" & rs4("cateid") & """"        
			if rs4("cateid") = cateid then response.write " selected"        
			response.write ">" & rs4("catetitle") & "</option>"        
			rs4.movenext        
		loop        
		response.write "</select>"        
	else        
		response.write "<font color=""red"">(错误: 无任何分类)</font>"        
	end if        
        
%>        
      </TD>        
    </TR>        
    <TR>         
      <TD>显示序号</TD>        
      <TD>         
        <INPUT type="text" name="displayorder" size="5" maxlength="5" value="<% =rs("displayorder") %>">        
        (如果序号为0则不显示)</TD>        
    </TR>        
    <TR  bgcolor="#F5F5F5">         
      <TD>版主</TD>        
      <TD>         
        <INPUT type="text" name="moder" size="30" maxlength="200" value="<% =moderstr %>">        
        <BR>        
        (版主名字间用英文字符逗号隔开, 例如: &quot;张三,李四,王五&quot;)</TD>        
    </TR>        
    <TR>         
      <TD>默认显示主题的时间范围</TD>        
      <TD>         
        <INPUT type="text" name="daysprune" size="5" maxlength="5" value="<% =rs("daysprune") %>">        
        (如果为0则为默认)</TD>        
    </TR>        
    <TR>         
      <TD bgcolor="#F5F5F5">参数</TD>        
      <TD bgcolor="#F5F5F5">         
        <INPUT type="checkbox" name="allowposting" value="1"<%=poststr%>>        
        允许发帖<BR>        
        <INPUT type="checkbox" name="canpostpoll" value="1"<%=pollstr%>>        
        允许发布投票<BR>        
        <INPUT type="checkbox" name="allowbbcode" value="1"<%=bbcodestr%>>        
        允许使用XB代码<BR>        
        <INPUT type="checkbox" name="allowimages" value="1"<%=imagesstr%>>        
        允许使用XB代码中的图片影像代码<BR>        
        <INPUT type="checkbox" name="allowuploadfile" value="1"<%=uploadstr%>>        
        允许上传附件文件<BR>        
        <INPUT type="checkbox" name="canmove" value="1"<%=movestr%>>        
        允许版主移动主题<BR>        
        <INPUT type="checkbox" name="canopenclose" value="1"<%=openstr%>>        
        允许版主打开关闭主题<BR>        
        <INPUT type="checkbox" name="candeletepost" value="1"<%=deletestr%>>        
        允许作者或版主删除帖子<BR>        
        <INPUT type="checkbox" name="canreply" value="1"<%=replystr%>>        
        允许发表回复<BR>        
        <INPUT type="checkbox" name="caneditpost" value="1"<%=editstr%>>        
        允许作者或版主编辑帖子<BR>        
        <INPUT type="checkbox" name="onlyuser" value="1"<%=userstr%>>        
        只限用户登录后访问<BR>        
        <INPUT type="checkbox" name="onlymember" value="1"<%=memberstr%>>        
        只限该版块会员内部访问</TD>        
    </TR>        
    <TR>         
      <TD>会员名单</TD>        
      <TD>         
        <TEXTAREA name="memberlist" cols="50" rows="8"><% =rs("memberlist") %></TEXTAREA>        
        <BR>        
        会员名字间用英文字符逗号隔开, 例如: &quot;张三,李四,王五&quot;</TD>        
    </TR>        
    <TR>         
      <TD>&nbsp;</TD>        
      <TD>&nbsp;</TD>        
    </TR>        
    <TR bgcolor="#CCCCCC">         
      <TD colspan="2" height="2"></TD>        
    </TR>        
    <TR align="center">         
      <TD colspan="2">         
        <INPUT type="hidden" name="step" value="2">        
        <INPUT type="hidden" name="forumid" value="<% =request("id") %>">        
        <INPUT type="submit" name="Submit" value="确 定">        
      </TD>        
    </TR>        
    <TR>         
      <TD>&nbsp;</TD>        
      <TD>&nbsp;</TD>        
    </TR>        
    <TR>         
      <TD>&nbsp;</TD>        
      <TD>&nbsp;</TD>        
    </TR>        
  </TABLE>        
</FORM>        
<%        
end if        
        
%>        
</BODY>        
</HTML>        

⌨️ 快捷键说明

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