www.gusucode.com > 仿MOP对开式论坛程序 1.0源码程序 > forumtypeadd.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 forumtype,typeorder,typeshow,typeadmin,i,edit,id
forumtype=Trim(Replace(Request.Form("forumtype"),"'",""))
typeorder=Request.Form("typeorder")
typeshow=Request.Form("typeshow")
typeadmin="{gb|mad}"& Trim(Replace(Replace(Request.Form("typeadmin"),"'",""),vbcrlf,"{gb|mad}")) &"{gb|mad}"
if IsNumeric(typeorder) then
typeorder=Clng(typeorder)
else
typeorder=255
end if
if typeorder<1 then typeorder=255
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 forumtype<>"" then
if id<>"0" then
rs.Open "forumtype Where id="& id,conn,1,3
if Not rs.Eof then
if typeorder<>rs("typeorder") then
rs("typeorder")=typeorder
rs.Update
else
typeorder=""
end if
end if
rs.Close
end if
if Not typeorder="" then
rs.Open "forumtype",conn,1,3
if typeorder>rs.RecordCount+1 then
typeorder=rs.RecordCount+1
else
For i=1 to rs.RecordCount
if rs("typeorder")+1>typeorder and (Not rs("id")=id) then rs("typeorder")=rs("typeorder")+1
rs.Update
rs.MoveNext
Next
end if
rs.Close
end if
rs.Open "forumtype Where id="& id,conn,1,3
if rs.Eof then
rs.AddNew
rs("typeorder")=typeorder
end if
rs("forumtype")=forumtype
if typeshow=1 then
rs("typeshow")=1
else
rs("typeshow")=0
end if
rs("typeadmin")=typeadmin
rs.Update
rs.Close
rs.Open "forumtype Order by typeorder",conn,1,3
For i=1 to rs.RecordCount
rs("typeorder")=i
rs.Update
rs.MoveNext
Next
rs.Close
contents=contents &"设置分类 "& forumtype &" 成功。<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 "forumtype Where id="& edit,conn,1,1
if rs.Eof then
edit=""
else
forumtype=rs("forumtype")
typeorder=rs("typeorder")
typeshow=rs("typeshow")
typeadmin=rs("typeadmin")
end if
rs.Close
else
rs.Open "Select Count(*) From forumtype",conn,1,1
typeorder=rs(0)+1
rs.Close
end if
typeadmin=Replace(typeadmin,"{gb|mad}",vbcrlf)
typeadmin=Left(typeadmin,Len(typeadmin)-2)
contents=contents &"<Script Language=""JavaScript"">"&_
"function validinput()"&_
"{"&_
"if (document.forumtypeadd.forumtype.value.length==0)"&_
"{"&_
"alert(""还没输入分类名称呢。"");"&_
"document.forumtypeadd.forumtype.focus();"&_
"return false;"&_
"}"&_
"return true;"&_
"}"&_
"</Script>"&_
"<form name=""forumtypeadd"" onsubmit=""return validinput();"" method=""post"" action=""forumtypeadd.asp"">"&_
"分类名称:<input type=""text"" name=""forumtype"" size=""25"" maxlength=""50"" class=""iptwin"" value="""& forumtype &"""><input type=""hidden"" name=""id"" value="""& edit &"""> <input type=""submit"" value=""设置"" class=""out"" onmouseover=""this.className='over'"" onmouseout=""this.className='out'""><br><br>"&_
"分类排序:<input type=""text"" name=""typeorder"" size=""3"" maxlength=""3"" class=""iptwin"" value="""& typeorder &"""> 显示分类:<input type=""checkbox"" name=""typeshow"" value=""1"""
if typeshow=1 or edit="0" then contents=contents &"checked"
contents=contents &"><br><br>"&_
"类管理员:<textarea rows=""2"" name=""typeadmin"" cols=""31"" style=""vertical-align:text-top"">"& typeadmin &"</textarea>"&_
"</form>分类排序处请输入1-255之间的数字,系统自动在你输入的位置插入,已存在分类则自动后移,如果只想排在其他分类后面则无需修改默认值。<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"-->