www.gusucode.com > 仿MOP对开式论坛程序 1.0源码程序 > forumadd.asp

    <%@Language="VBScript"%>
<!--#include file="title.asp"-->
<%
contents=contents &"<title>添加/设置版面-"& caption &"</title>"&_
"</head>"&_
"<body>"&_
"<table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"">"&_
"<tr><td width=""5"" height=""15""><img border=""0"" src="""& theme &"01.gif""></td><td background="""& theme &"02.gif"">&nbsp;</td><td width=""14"" height=""15""><img border=""0"" src="""& theme &"03.gif""></td></tr>"&_
"</table>"&_
"<table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"" class=""tdc"">"&_
"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">添加/设置版面</td></tr>"&_
"<tr class=""tds""><td>"
if bbsadmin=5 then
Dim forumname,foruminfo,forumorder,forumtype,typeshow,forumshow,i,edit,id,oldtype,forumadmin
forumname=Trim(Replace(Request.Form("forumname"),"'",""))
foruminfo=Trim(Replace(Request.Form("foruminfo"),"'",""))
forumorder=Request.Form("forumorder")
forumtype=Request.Form("forumtype")
forumshow=Request.Form("forumshow")
forumadmin="{gb|mad}"& Trim(Replace(Replace(Request.Form("forumadmin"),"'",""),vbcrlf,"{gb|mad}")) &"{gb|mad}"
if forumtype="" then forumtype=Request.QueryString("forumtype")
if IsNumeric(forumorder) then
forumorder=Clng(forumorder)
else
forumorder=255
end if
if forumorder<1 then forumorder=255
if IsNumeric(forumtype) then
forumtype=Clng(forumtype)
else
forumtype=""
end if
edit=Request.QueryString("edit")
if IsNumeric(edit) then
edit=Clng(edit)
else
edit="0"
end if
id=Request.Form("id")
if IsNumeric(id) then
id=Clng(id)
else
id="0"
end if
if forumname<>"" and forumtype<>"" then
if id<>"0" then
rs.Open "forum Where id="& id,conn,1,3
if Not rs.Eof then
if forumorder<>rs("forumorder") or forumtype<>rs("forumtype") then
rs("forumorder")=forumorder
if rs("forumtype")=forumtype then
oldtype=forumtype
else
oldtype=rs("forumtype")
rs("forumtype")=forumtype
end if
rs.Update
else
forumorder=""
end if
end if
rs.Close
end if
if Not forumorder="" then
if oldtype<>forumtype and oldtype<>"" then
rs.Open "forum Where forumtype="& oldtype,conn,1,3
For i=1 to rs.RecordCount
rs("forumorder")=i
rs.Update
rs.MoveNext
Next
rs.Close
end if
rs.Open "forum Where forumtype="& forumtype,conn,1,3
if forumorder>rs.RecordCount+1 then
forumorder=rs.RecordCount+1
else
For i=1 to rs.RecordCount
if rs("forumorder")+1>forumorder and (Not rs("id")=id) then rs("forumorder")=rs("forumorder")+1
rs.Update
rs.MoveNext
Next
end if
rs.Close
end if
rs.Open "forum Where id="& id,conn,1,3
if rs.Eof then
rs.AddNew
rs("forumorder")=forumorder
rs("forumtype")=forumtype
end if
rs("forumname")=forumname
if forumshow=1 then
rs("forumshow")=1
else
rs("forumshow")=0
end if
rs("foruminfo")=foruminfo
rs("forumadmin")=forumadmin
rs.Update
rs.Close
rs.Open "forum Where forumtype="& forumtype &" Order by forumorder",conn,1,3
For i=1 to rs.RecordCount
rs("forumorder")=i
rs.Update
rs.MoveNext
Next
rs.Close
contents=contents &"设置版面 "& forumname &" 成功。<Script Language=""JavaScript"">setTimeout(""location.href='forumtype.asp'"",3000)</Script><br><br>2秒后返回分类设置。或者<a href=""forumtype.asp"">点击这里返回</a>。"
else
if edit<>"0" then
rs.Open "forum Where id="& edit,conn,1,1
if rs.Eof then
edit=""
else
forumname=rs("forumname")
foruminfo=rs("foruminfo")
forumadmin=rs("forumadmin")
forumorder=rs("forumorder")
forumtype=rs("forumtype")
forumshow=rs("forumshow")
end if
rs.Close
else
rs.Open "Select Count(*) From forum Where forumtype="& forumtype,conn,1,1
forumorder=rs(0)+1
rs.Close
end if
forumadmin=Replace(forumadmin,"{gb|mad}",vbcrlf)
forumadmin=Left(forumadmin,Len(forumadmin)-2)
contents=contents &"<Script Language=""JavaScript"">"&_
"function validinput()"&_
"{"&_
"if (document.forumadd.forumname.value.length==0)"&_
"{"&_
"alert(""还没输入版面名称呢。"");"&_
"document.forumadd.forumname.focus();"&_
"return false;"&_
"}"&_
"if (document.forumadd.forumtype.value.length==0)"&_
"{"&_
"alert(""还没选择版面所属分类呢。"");"&_
"document.forumadd.forumtype.focus();"&_
"return false;"&_
"}"&_
"return true;"&_
"}"&_
"</Script>"&_
"<form name=""forumadd"" onsubmit=""return validinput();"" method=""post"" action=""forumadd.asp"">"&_
"版面名称:<input type=""text"" name=""forumname"" size=""25"" maxlength=""50"" class=""iptwin"" value="""& forumname &"""><input type=""hidden"" name=""id"" value="""& edit &"""> <input type=""submit"" value=""设置"" class=""out"" onmouseover=""this.className='over'"" onmouseout=""this.className='out'""><br><br>"&_
"所属分类:<select size=""1"" name=""forumtype"">"
rs.Open "forumtype Where id="& forumtype,conn,1,1
if rs.Eof then
contents=contents &"<option value="""" selected>请选择所属分类</option>"
else
contents=contents &"<option value="""& forumtype &""" selected>"& rs("forumtype") &"</option>"
typeshow=rs("typeshow")
end if
rs.Close
rs.Open "Select id,forumtype From forumtype Order by typeorder",conn,1,1
For i=1 to rs.RecordCount
contents=contents &"<option value="""& rs("id") &""">"& rs("forumtype") &"</option>"
rs.MoveNext
Next
rs.Close
contents=contents &"</select><br><br>版面排序:<input type=""text"" name=""forumorder"" size=""3"" maxlength=""3"" class=""iptwin"" value="""& forumorder &"""> 显示版面:<input type=""checkbox"" name=""forumshow"" value=""1"""
if forumshow=1 or edit="0" then contents=contents &"checked"
contents=contents &"><br><br>"&_
"版面说明:<textarea rows=""2"" name=""foruminfo"" cols=""31"" style=""vertical-align:text-top"">"& foruminfo &"</textarea><br><br>"&_
"版管理员:<textarea rows=""2"" name=""forumadmin"" cols=""31"" style=""vertical-align:text-top"">"& forumadmin &"</textarea>"&_
"</form>版面排序处请输入1-255之间的数字,系统自动在你输入的位置插入,已存在版面则自动后移,如果只想排在其他版面后面则无需修改默认值。<br>版面管理员之间请用回车换行间隔开来,父分类管理员也是版面的管理员。<br>如果版面所属分类为不显示,即使把版面选择为显示也是不显示。"
end if
else
call connclose
Response.Redirect "login.asp"
end if
contents=contents &"</td></tr>"&_
"</table>"&_
"<table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"">"&_
"<tr><td width=""5"" height=""15""><img border=""0"" src="""& theme &"02.gif""></td><td background="""& theme &"02.gif"">&nbsp;</td><td width=""14"" height=""15""><img border=""0"" src="""& theme &"02.gif""></td></tr>"&_
"</table>"
%>
<!--#include file="bottom.asp"-->