📄 adminedit.asp
字号:
<%@ Language=VBScript%>
<%
Response.Buffer=true
Response.Expires=0
%>
<!-- #include file="../links.asp" -->
<!-- #include file="./s.asp" -->
<!-- #include file="../dsn.asp" -->
<%
if session("adminusername")="" then
session("xhy")=1
Response.Redirect linkwarn
end if
id=cint(Request.QueryString("id"))
pid=cint(Request.QueryString("pid"))
ppid=cint(Request.QueryString("ppid"))
pageno=Request.QueryString ("pageno")
backhtml=linkadmin&"?pid="&pid&"&ppid="&ppid&"&pageno="&pageno&"&id="&id
set cn=Server.CreateObject("ADODB.Connection")
set rs0=Server.CreateObject("ADODB.Recordset")
set rs1=Server.CreateObject("ADODB.Recordset")
set rs2=Server.CreateObject("ADODB.Recordset")
set rs3=Server.CreateObject("ADODB.Recordset")
cn.Open mycnstr
if ppid<>"" then
sqltext="select title from bbs_p_scool where id="&ppid
rs1.Open sqltext,cn,1,1
if not rs1.EOF then
bbs_p_scoolname=rs1("title")
end if
rs1.Close
end if
if pid<>"" then
sqltext="select title from bbs_p_classes where id="&pid
rs1.Open sqltext,cn,1,1
if not rs1.EOF then
classname=rs1("title")
end if
rs1.Close
end if
function idadd(oldtabname) '得到该表最大ID号
sqltext="select * from tab_id where tab_name='"+oldtabname+"'"
rs0.Open sqltext,cn,1,2
if not rs0.EOF then
rs0("tab_id")=rs0("tab_id")+1
else
rs0.AddNew
rs0("tab_name")=oldtabname
rs0("tab_id")=1
end if
rs0.Update
idadd=rs0("tab_id")
rs0.Close
end function
function pladd(oldtabname,oldpid) '得到该表最大排列号
sqltext="select * from "+oldtabname+" where pid="&oldpid&" order by pl desc"
rs0.Open sqltext,cn,1,1
if not rs0.EOF then
pladd=rs0("pl")+1
else
pladd=1
end if
rs0.Close
end function
if Request.ServerVariables("REQUEST_METHOD")="POST" then
title=trim(Request.Form("title"))
pl=trim(Request.Form("t1"))
if pl="" or not isnumeric(pl) then
pl=pladd("bbs_class",0)
end if
if pl="" or not isnumeric(pl) then pl=1
sqltext3="select * from bbs_class where bbstitle='"+title+"' and id<>"&id
rs2.Open sqltext3,cn,1,1
if not rs2.EOF then
err=1
errtxt="错误:版块“"&title&"”已存在,请换名重试!"
title=""
end if
rs2.Close
if err<>1 and id=0 then
sqltext="select * from bbs_class"
rs1.Open sqltext,cn,1,2
rs1.AddNew
rs1("id")=cint(idadd("bbs_class"))
rs1.Update
id=rs1("id")
rs1.Close
end if
if err<>1 and id<>0 then
sqltext2="select * from bbs_class where id="&id
rs1.Open sqltext2,cn,1,2
rs1("bbstitle")=title
rs1("creatdate")=now()
rs1("pl")=pl
if Request.Form("c1")="1" then
rs1("enable")=1
else
rs1("enable")=0
end if
if Request.Form("upflag")="1" then
rs1("upflag")=1
else
rs1("upflag")=0
end if
rs1("content")=trim(Request.Form ("content"))
rs1("filesize")=trim(Request.Form ("filesize"))
oldadmin=trim(rs1("admin_user"))
rs1("admin_user")=trim(Request.Form ("adminman"))
rs1.Update
rs1.Close
ztz=trim(Request.Form ("adminman"))
sqltext3="delete from admin_man where classid="&id '删除老斑竹
cn.Execute sqltext3
if oldadmin<>"" then
if instr(oldadmin,"/")>0 then
dim oldadminall
oldadminall=split(oldadmin,"/")
for i=0 to ubound(oldadminall)
sqltext2="select * from [user] where user_name='"+oldadminall(i)+"'"
rs2.Open sqltext2,cn,1,2
if not rs2.EOF then
rs2("admin_flag")=0
rs2.Update
end if
rs2.Close
next
else
sqltext2="select * from [user] where user_name='"+oldadmin+"'"
rs2.Open sqltext2,cn,1,2
if not rs2.EOF then
rs2("admin_flag")=0
rs2.Update
end if
rs2.Close
end if
end if
sqltext="select * from admin_man" '添加新斑竹
rs1.Open sqltext,cn,1,2
if ztz<>"" then
if instr(ztz,"/")>0 then
dim adminall
adminall=split(ztz,"/")
for i = 0 to ubound(adminall)
sqltext2="select * from [user] where user_name='"+adminall(i)+"'"
rs2.Open sqltext2,cn,1,2
if not rs2.EOF then
rs2("admin_flag")=1
newadminuserid=0
newadminuserid=rs2("id")
rs2.Update
rs1.AddNew
rs1("id")=cint(idadd("admin_man"))
rs1("userid")=newadminuserid
rs1("username")=adminall(i)
rs1("classid")=id
rs1.Update
end if
rs2.Close
next
else
sqltext2="select * from [user] where user_name='"+ztz+"'"
rs2.Open sqltext2,cn,1,2
if not rs2.EOF then
rs2("admin_flag")=1
newadminuserid=0
newadminuserid=rs2("id")
rs2.Update
rs1.AddNew
rs1("id")=cint(idadd("admin_man"))
rs1("userid")=newadminuserid
rs1("username")=ztz
rs1("classid")=id
rs1.Update
end if
rs2.Close
end if
end if
rs1.close
Response.Redirect backhtml
end if
end if
if id<>0 then
sqltext1="select * from bbs_class where id="&id
rs1.Open sqltext1,cn,1,1
cbbs_p_danweiname=trim(rs1("bbstitle"))
yxx=rs1("enable")
creadate=rs1("creatdate")
title=trim(rs1("bbstitle"))
adminman=trim(rs1("admin_user"))
pl=rs1("pl")
content=trim(rs1("content"))
upflag=rs1("upflag")
filesize=trim(rs1("filesize"))
filesize=trim(rs1("filesize"))
rs1.Close
if len(bbs_p_danweiname)>18 then
bbs_p_danweiname=left(bbs_p_danweiname,18)&"..."
end if
else
bbs_p_danweiname="增加新条目"
yxx=1
dateyxx=1
end if
txtname="名称"
%>
<html>
<head>
<title>网站管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {font-size: 12px; color: #000000; font-family: 宋体}
td {font-size: 12px; color: #000000; font-family: 宋体;line-height:130%}
.t1 {font:12px 宋体;color=000000}
.t2 {font:12px 宋体;color:ffffff}
.t3 {font:12px 宋体;color:336699}
.t4 {font:12px 宋体;color:ff0000}
.t5 {font:12px 宋体;color:ff6600}
.bt1 {font:14px 宋体;color=000000}
.bt2 {font:12px 宋体;color:ffffff}
.bt3 {font:14px 宋体;color:336699}
.bt4 {font:14px 宋体;color:ff0000}
.bt5 {font:14px 宋体;color:0000ff}
.bt10 {font:14px 宋体;color:0000ff}
.td1 {font-size:12px;background-color:#3388bb;color:#ffffff}
.td2 {font-size:12px;background-color:#ffffff;color:#000000;}
A:link {color: #000077}
A:visited {color: #000077}
A:hover {color: #ff0000}
A.r1:link {text-decoration:none;color:#304556;}
A.r1:visited {text-decoration:none;color:#304556;}
A.r1:hover {text-decoration:underline;color:ff6600;}
A.r2:link {text-decoration:none;color:#ffffff;}
A.r2:visited {text-decoration:none;color:#ffffff;}
A.r2:hover {text-decoration:underline;color:cccc00;}
-->
</style>
</head>
<body bgcolor=#ffffff topmargin=10>
<form action="<%=linkadminedit%>?id=<%=id%>&pid=<%=pid%>&ppid=<%=ppid%>" method=post name=editform onsubmit="return checkeditform(editform)">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td><font class=t5>当前位置:<%=bbs_p_scoolname%>→ <%=classname%>→ <%=bbs_p_danweiname%></b></font>
← <a href="<%=backhtml%>">返回列表</a></td>
</tr>
<tr><td><hr size=1></td></tr>
<tr bgcolor="#666669"><td height=20><font class=bt2>具体内容</font><br>
</td></tr>
<tr><td height=5></td></tr>
</table>
<div align=center class=t1><font color="red" size=2><b><%=errtxt%></b></font></div>
<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
<tr><td width=70 align=right>是否有效:</td>
<td>
<%if yxx=1 then%>
<input type="checkbox" checked name="c1" value=1>
<%else%>
<input type="checkbox" name="c1" value=1>
<%end if%>
(更新时间:<font color=000000><%=creadate%></font>
)
</td></tr>
<tr><td width=70 align=right>序号:</td><td><input type="text" value="<%=pl%>" name="t1" maxlength=60 size=10><font color=red>(可选,不填则系统自动生成)</font></td></tr>
<tr><td width=70 align=right><%=txtname%>:</td>
<td><input type="text" value="<%=title%>" name=title maxlength=60 size=45><font color=red>*</font></td></tr>
<tr><td width=70 align=right>版主:</td>
<td><input type="text" value="<%=adminman%>" name=adminman maxlength=60 size=25><font color=red>请直接填入会员帐号,多个请用“/”格开</font></td></tr>
<tr><td width=70 align=right>上传图片:</td>
<td>是否允许:<input type="checkbox" value="1" name=upflag <%if upflag=1 then Response.Write ("checked")%>> 文件大小为:<input type="text" name=filesize size=5 maxlength=3 value="<%=filesize%>"> K
</td></tr>
<tr><td width=70 align=right>版面说明:</td>
<td><textarea rows=10 cols=60 name=content style="font-family:宋体" ><%=content%></textarea></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td width=80></td><td height=10></td></tr>
<tr>
<td width=80></td>
<td align=left>
<input type="submit" name="ss1" value="确认提交">
</td></tr>
<tr><td width=80></td><td height=10></td></tr>
</table>
</form>
</body>
</html>
<script language=Javascript>
function format(flag)
{
switch(flag){
case "bold":
begintxt="<b>";
endtxt="</b>";
break;
case "italic":
begintxt="<i>";
endtxt="</i>";
break;
case "underline":
begintxt="<u>";
endtxt="</u>";
break;
case "center":
begintxt="<center>";
endtxt="</center>";
break;
case "space":
begintxt=" ";
endtxt="";
break;
}
dealcontent()
}
function formatpic(newvalue)
{
if(newvalue!=0){
begintxt="<table width=100% border=0 cellspacing=0 cellpadding=0 align=center><tr><td align=center><img src=./jpg.asp?tabname=bbs_p_danweipic&id="+newvalue+"></td></tr></table>"
endtxt="";
dealcontent()}
}
function formaturl(newvalue)
{
var urladd=window.prompt ("请在输入链接地址!","http://")
begintxt="<a href="+urladd+">"
endtxt="</a>";
dealcontent()
}
function formatcolor(newvalue)
{
begintxt="<font color="+newvalue+">"
endtxt="</font>";
dealcontent()
}
function formatfont(newvalue)
{
begintxt="<font face="+newvalue+">"
endtxt="</font>";
dealcontent()
}
function formatsize(newvalue)
{
begintxt="<font size="+newvalue+">"
endtxt="</font>";
dealcontent()
}
function dealcontent()
{
if ((document.selection)&&(document.selection.type == "Text"))
{
var range = document.selection.createRange();
var ch_text=range.text;
range.text = begintxt + ch_text + endtxt;
}
else
{
document.editform.content.value=begintxt+document.editform.content.value+endtxt;
document.editform.content.focus();
}
}
function gopreview()
{
document.preview.viewtitle.value=document.editform.title.value;
document.preview.viewbody.value=document.editform.content.value;
window.open('<%=linkbodyview%>', 'winview', 'scrollbars=yes,width=500,height=400');
document.preview.submit()
}
function checkeditform(form)
{
var flag=true;
if(form("title").value=="")
{alert("<%=txtname%>不能为空!");form("title").focus();return false}
return flag;
}
</script>
<%
function checkstring(str)
if str<>"" then
a=instr(str,"http://")
if a<>1 then
checkstring="http://"&str
else
checkstring=str
end if
end if
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -