📄 lbadminedit.asp
字号:
<%@ Language=VBScript%>
<!-- #include file="../dsn.asp" -->
<!-- #include file="../links.asp" -->
<%
Response.Buffer=true
Response.Expires=0
%>
<%
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"))
cpflag=Request.QueryString("cpflag")
if cpflag="" then
cpflag=0
else
cpflag=cint(cpflag)
end if
backhtml=linklbadmin&"?pid="&pid&"&ppid="&ppid&"&cpflag="&cpflag
creadate=now()
set cn=Server.CreateObject("ADODB.Connection")
set rs1=Server.CreateObject("ADODB.Recordset")
set rs2=Server.CreateObject("ADODB.Recordset")
set rs3=Server.CreateObject("ADODB.Recordset")
cn.Open mycnstr
scoolname="类别管理"
if cpflag=1 then
if ppid=0 then
tabname="scool"
classesname="大类"
else
tabname="classes"
classesname="小类"
end if
else
if pid=1 then
tabname="classes"
classesname="小类"
elseif pid>1 then
tabname="danwei"
sqltext="select name from scool where id="&ppid
rs1.Open sqltext,cn,1,1
if not rs1.EOF then
scoolname=rs1("name")
end if
rs1.Close
sqltext="select name from classes where id="&pid
rs1.Open sqltext,cn,1,1
if not rs1.EOF then
classesname=rs1("name")
end if
rs1.Close
backhtml=linkcpadmin&"?pid="&pid&"&ppid="&ppid
elseif pid=0 then
tabname="scool"
classesname="大类"
end if
end if
%>
<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
yx=Request.Form("c1")
if pid=1 then
lbpid=cint(Request.Form ("s1"))
end if
title=trim(Request.Form("title"))
pl=trim(Request.Form("t1"))
if pl="" or not isnumeric(pl) then
if pid=1 then
sqltext3="select max(pl) as maxpl from "+tabname+" where pid="&lbpid
elseif pid=0 then
sqltext3="select max(pl) as maxpl from "+tabname
end if
'Response.Write pid
'Response.End
rs2.Open sqltext3,cn,1,1
if not rs2.EOF then
pl=rs2("maxpl")+1
end if
rs2.Close
else
pl=cint(pl)
end if
if pl="" or not isnumeric(pl) then pl=1
if id=0 then
if ppid=0 then
sqltext3="select * from "+tabname+" where name='"+title+"' and flag=1"
else
sqltext3="select * from "+tabname+" where name='"+title+"' and pid="&ppid
if pid>1 then
sqltext3="select * from "+tabname+" where name='"+title+"' and pid="&pid
end if
end if
rs2.Open sqltext3,cn,1,1
if not rs2.EOF then
errtxt="错误:标题:“"&title&"”已存在,请换名重试!"
title=""
else
sqltext2="select * from "+tabname
rs1.Open sqltext2,cn,1,2
rs1.AddNew
if yx="on" then
rs1("enable")=1
end if
if yx="" then
rs1("enable")=0
end if
rs1.Update
id=rs1("id")
rs1.Close
end if
rs2.Close
end if
sqltext2="select * from "+tabname+" where id="&id
rs1.Open sqltext2,cn,1,2
rs1("name")=title
rs1("pl")=pl
if session("cpflag")=0 then
rs1("flag")=0
if pid<>0 then
rs1("pid")=lbpid
end if
else
rs1("flag")=1
if ppid<>0 then
if pid>1 then
rs1("pid")=pid
rs1("ppid")=ppid
else
rs1("pid")=ppid
end if
end if
end if
rs1.Update
id=rs1("id")
rs1.Close
Response.Redirect backhtml
end if
if id<>0 then
sqltext1="select * from "+tabname+" where id="&id
rs1.Open sqltext1,cn,1,1
title=rs1("name")
yxx=rs1("enable")
if pid<>0 then
lbpid=rs1("pid")
end if
pl=rs1("pl")
rs1.Close
if len(title)>18 then
title=left(title,18)&"..."
else
title=title
end if
else
title="增加新条目"
yxx=1
dateyxx=1
end if
%>
<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="<%=linklbadminedit%>?id=<%=id%>&pid=<%=pid%>&ppid=<%=ppid%>&cpflag=<%=cpflag%>" method=post name=editform>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td><font class=t5>当前位置:<%=scoolname%>→ <%=classesname%>→ <%=title%></b></font>
← <a href="<%=backhtml%>">返回列表</a></td>
</tr>
<tr><td><hr size=1></td></tr>
<tr bgcolor=ffe4c4><td height=20><font class=t1>具体内容</font><br>
</td></tr>
<tr><td height=5></td></tr>
</table>
<div align=center class=t1><font color="red"><b><%=errtxt%></b></font></div>
<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
<tr><td width=70 align=right><%if id=0 then%>有效性<%end if%></td>
<td>
<%if id=0 then
if yxx=1 then%>
<input type="checkbox" checked name="c1">
<%else%>
<input type="checkbox" name="c1">
<%end if%>
<%end if%>(创建日期:<font color=000000><%=creadate%></font>
<%if pid=7 then
if dateyxx=1 then%>
<input type="checkbox" checked name="c2">
<%else%>
<input type="checkbox" name="c2">
<%end if%>
在前台显示该时间
<%end if%>)</td>
</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>名称</td>
<td><input type="text" value="<%=title%>" name=title maxlength=60 size=35><font color=red>*</font></td></tr>
<%if pid=1 then%>
<tr><td width=70 align=right>所属大类</td><td>
<select name=s1 size=1>
<%
sqltext="select id,name from scool"
rs1.Open sqltext,cn,1,1
do while not rs1.EOF
if lbpid=rs1("id") then%>
<option value="<%=rs1("id")%>" selected><%=rs1("name")%></option>
<%else%>
<option value="<%=rs1("id")%>"><%=rs1("name")%></option>
<%end if
rs1.MoveNext
loop
rs1.Close %>
</select>
</td></tr>
<%end if%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td width=200></td><td height=10></td></tr>
<tr>
<td width=200></td>
<td align=left>
<input type="button" name="button1" value="确认提交" onclick="check1()">
</td></tr>
<tr><td width=200></td><td height=10></td></tr>
</table>
</form>
<script language=vbscript>
sub check1()
dim form1
set form1=document.editform
if form1("title").value="" then
alert("名称不能为空!")
form1.title.focus
else
form1.submit
end if
end sub
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -