📄 admins_server.asp
字号:
<!-- #include file="include/admin_onlogin.asp" -->
<%
admins=true
dim n_data_name,n_rss_record,ndim,nnum,ntits
index_url="server"
data_name="jk_server"
tit_fir="服务器"
tit="服务器列表"
call admin_cid_sid()
call admin_header(0,0)
nsort=""
ntit=tit
call joekoe_chk_dim()
%>
<tr><td align=center colspan=2 height=30>
<table border=0>
<tr>
<td><a href='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write nsort%>'><%response.write ntit%>列表</a></td>
<td width=10></td>
<td><a href='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write nsort%>&action=add'>添加新<%response.write ntit%></a></td>
<td width=10></td>
<td><a href='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write nsort%>&action=batch'><%response.write ntit%>数据批量处理</a></td>
</tr>
</table>
</td></tr>
</table>
<%
call admin_table(1)
call admin_td(ntit)
if int(nnum)<0 then
response.write vbcrlf&"<tr><td align=center height=100 colspan=2><font class=red>暂时没有"&tit_fir&"栏目可管理!</font><br><br>请先在 <a href='admins_menu.asp'>管理菜单</a> 里设置正确。</td></tr>"
else
response.write vbcrlf&"<tr align=center valign=top><td>" & _
vbcrlf&"<table class=table2>" & _
vbcrlf&"<tr><td width=15></td><td></td></tr>"
for i=0 to nnum
if nsort=ndim(0,i) then
response.write vbcrlf&"<tr><td align=center>"&img_admin("s_left_sort","")&"</td><td><a href='?jk_mod="&jk_mod&"&nsort="&ndim(0,i)&"&action="&action&"' class=red2>"&ndim(1,i)&tit_fir&"</a></td></tr>"
else
response.write vbcrlf&"<tr><td align=center>"&img_admin("s_nsort","")&"</td><td><a href='?jk_mod="&jk_mod&"&nsort="&ndim(0,i)&"&action="&action&"'>"&ndim(1,i)&tit_fir&"</a></td></tr>"
end if
next
response.write vbcrlf&"</table>" & _
vbcrlf&"</td><td align=left>"
select case action
case "batch"
call joekoe_chk_batch()
case "del"
call joekoe_chk_del()
case "add"
call joekoe_chk_add()
case "edit"
call joekoe_chk_edit()
case else
call joekoe_chk_main()
end select
response.write vbcrlf&"</td></tr>"
end if
call joekoe_chk_erase()
call admin_ender(1)
sub joekoe_chk_batch()
dim is_all,server_id
%>
<table border=0 cellspacing=1 cellpadding=3 class=table0>
<tr><td colspan=2 align=center height=30 class=td><b><%response.write ntit%>数据批量处理</b> (表:<b class=red><%response.write n_data_name%></b>)</td></tr>
<%
if chk() then
is_all=false
if trim(request.form("is_all"))="yes" then is_all=true
csid=trim(request.form("c_id"))
call chk_cid_sid()
server_id=trim(request.form("server_id"))
if int(server_id)<1 then server_id=0
if (is_all=false and cs_nd(csid)=false) or int(server_id)<1 then
call admin_error("请选择 "&ntit&" 的 分类 和 "&tit_fir&"ID!")
response.write vbcrlf&"</table>"
exit sub
end if
sql="update "&n_data_name&" set server_id="&server_id
if is_all=false then
'条件选择
if nsort="music" then
sql=sql&" where diskid="&csid
elseif nsort="video" then
sql=sql&" where server_id="&csid
else
if int(cid)>0 then
if int(sid)>0 then
sql=sql&" where s_id="&sid
else
sql=sql&" where c_id="&cid
end if
end if
end if
end if
call joekoe_cms.exec(sql,0)
call admin_msg("已成功对"&ntit&"数据进行批量处理!","?jk_mod="&jk_mod&"&nsort="&nsort&"&action="&action,1)
response.write vbcrlf&"</table>"
exit sub
end if
call form_first()
%>
<form action='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write nsort%>&action=batch' method=post>
<input type=hidden name=chk value='yes'>
<tr><td height=30>所有<%response.write tit_fir%>:</td><td><input type=checkbox name=is_all value='yes'>选择将对所有<%response.write ntit%>数据进行批量处理</td></tr>
<%if nsort="music" then%>
<tr><td height=30>专辑列表:</td><td><%call music_sel_d_id()%></td></tr>
<%elseif nsort="video" then%>
<tr><td height=30>原服务器:</td><td><%call server_select(nsort,"c_id")%></td></tr>
<%else%>
<tr><td height=30><%response.write ntits%>分类:</td><td><%call chk_csid(nsort,cid,sid)%></td></tr>
<%end if%>
<tr><td height=30><%response.write tit_fir%>选择:</td><td><%call server_select(nsort,"server_id")%></td></tr>
<tr><td colspan=2 align=center height=30><input type=submit value='进行<%response.write ntit%>数据批量处理' onclick="javascript:return click_return('对<%response.write ntit%>数据进行批量处理',0);"></td></tr>
</form>
</table><%
end sub
sub joekoe_chk_del()
dim del_true
del_true=false
dim is_all,server_id
sql="select count(*) from "&n_data_name&" where server_id="&id
set rs=joekoe_cms.exec(sql,1)
if rs(0)>0 then del_true=true
rs.close
if del_true=true then
call admin_msg("删除"&ntit&"失败:"&ntit&"(ID:"&id&")下有数据存在!\n\n请先进行"&ntit&"数据处理后再尝试删除。","?nsort="&nsort,1)
else
call joekoe_cms.exec("delete from "&data_name&" where nsort='"&nsort&"' and s_id="&id,0)
call admin_msg("已成功删除一个"&ntit&"(ID:"&id&")!","?nsort="&nsort,1)
end if
end sub
sub joekoe_chk_edit()
dim rs2,s_name,s_url
sql="select top 1 * from "&data_name&" where nsort='"&nsort&"' and s_id="&id
call joekoe_cms.exec(sql,-1)
rs.open sql,conn,1,3
if rs.eof then
rs.close
call admin_msg(tit_fir&"ID("&id&")不存在!","?",1)
exit sub
end if
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr>
<td class=td width='20%'></td>
<td class=td width='80%'>编辑<%response.write ntit%></td>
</tr><%
if joekoe_cms.chk() then
s_name=code_admin("s_name",1,20)
s_url=code_admin("s_url",1,250)
if s_name="" or s_url="" or s_url="http://" then
call admin_error(tit_fir&"的 ID、名称 和 地址 不能为空!")
response.write "</table>"
exit sub
end if
if right(s_url,1)<>"/" then
s_url=s_url&"/"
end if
sql="select count(s_id) from "&data_name&" where nsort='"&nsort&"' and s_id<>"&id&" and s_name='"&s_name&"'"
set rs2=joekoe_cms.exec(sql,1)
if rs2(0)>0 then
rs2.close
set rs2=nothing
call admin_error(tit_fir&"(ID:"&id&")的 名称("&s_name&") 不能重复!")
response.write "</table>"
exit sub
end if
rs2.close
set rs2=nothing
rs("s_name")=s_name
rs("s_url")=s_url
rs.update
rs.close
call admin_msg("成功编辑一条"&ntit&"("&s_name&")信息!","?nsort="&nsort,1)
response.write "</table>"
exit sub
end if
call form_first()
%>
<form name=add_frm action='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write nsort%>&action=edit&id=<%response.write id%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td><%response.write tit_fir%>ID:</td>
<td><%response.write id%><%response.write redx%>不可以修改</td>
</tr>
<tr>
<td><%response.write tit_fir%>名称:</td>
<td><input type=text name=s_name value='<%response.write rs("s_name")%>' size=30 maxlength=20><%response.write redx%></td>
</tr>
<tr>
<td><%response.write tit_fir%>地址:</td>
<td><input type=text name=s_url value='<%response.write rs("s_url")%>' size=50 maxlength=250><%response.write redx%></td>
</tr><%
rs.close
call submit_edit()
response.write "</table>"
end sub
sub joekoe_chk_add()
dim tmp_sid,s_id,s_name,s_url
tmp_sid=0
sql="select s_id from "&data_name&" where nsort='"&nsort&"' order by s_id desc"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
tmp_sid=int(rs(0))+1
else
tmp_sid=1
end if
rs.close
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr>
<td class=td width='20%'></td>
<td class=td width='80%'>添加<%response.write ntit%></td>
</tr>
<%
if joekoe_cms.chk() then
s_id=trim(request.form("s_id"))
s_name=code_admin("s_name",1,20)
s_url=code_admin("s_url",1,250)
if int(s_id)<1 or s_name="" or s_url="" or s_url="http://" then
call admin_error(tit_fir&"的 ID、名称 和 地址 不能为空!")
response.write "</table>"
exit sub
end if
if right(s_url,1)<>"/" then
s_url=s_url&"/"
end if
sql="select count(s_id) from "&data_name&" where nsort='"&nsort&"' and (s_id="&s_id&" or s_name='"&s_name&"')"
set rs=joekoe_cms.exec(sql,1)
if rs(0)>0 then
rs.close
call admin_error(tit_fir&"的 ID("&s_id&") 和 名称("&s_name&") 不能重复!")
response.write "</table>"
exit sub
end if
rs.close
sql="select * from "&data_name
call joekoe_cms.exec("",-1)
rs.open sql,conn,1,3
rs.addnew
rs("s_id")=s_id
rs("nsort")=nsort
rs("s_name")=s_name
rs("s_url")=s_url
rs.update
rs.close
call admin_msg("成功添加一条"&ntit&"("&s_name&")信息!","?nsort="&nsort,1)
response.write "</table>"
exit sub
end if
call form_first()
%>
<form name=add_frm action='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write nsort%>&action=add' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td><%response.write tit_fir%>ID:</td>
<td><input type=text name=s_id value='<%response.write tmp_sid%>' size=10 maxlength=10><%response.write redx%>添加后将不可以修改</td>
</tr>
<tr>
<td><%response.write tit_fir%>名称:</td>
<td><input type=text name=s_name value='' size=30 maxlength=20><%response.write redx%></td>
</tr>
<tr>
<td><%response.write tit_fir%>地址:</td>
<td><input type=text name=s_url value='http://' size=50 maxlength=250><%response.write redx%></td>
</tr>
<%
call submit_add()
response.write "</table>"
end sub
sub joekoe_chk_main()
dim s_id,s_name
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr align=center>
<td class=td width='15%'><%response.write tit_fir%>ID</td>
<td class=td width='20%'><%response.write ntit%>名称</td>
<td class=td width='50%'><%response.write ntit%>地址</td>
<td class=td width='20%'>相关操作</td>
</tr>
<%
sql="select * from "&data_name&" where nsort='"&nsort&"' order by s_id"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
s_id=rs("s_id")
s_name=rs("s_name")
%>
<tr align=center>
<td><%response.write s_id%></td>
<td align=left><%response.write s_name%></td>
<td align=left><%response.write joekoe_cms.code_html(rs("s_url"),1,30+tnum)%></td>
<td><a href='?action=edit&nsort=<%response.write nsort%>&id=<%response.write s_id%>'>编辑</a> <a href='?action=del&nsort=<%response.write nsort%>&id=<%response.write s_id%>' onclick="javascript:return click_return('删除<%response.write ntit%>(<%response.write s_name%>)',0);">删除</a></td>
</tr>
<%
rs.movenext
loop
rs.close
%></table><%
end sub
sub joekoe_chk_dim()
dim tmpsort
tmpsort=trim(request.querystring("nsort"))
nnum=-1
sql="select m_nsort,m_tit_fir,m_data_name from admin_menu where m_on_server=1 order by m_id"
call joekoe_cms.exec("",-1)
rs.open sql,conn,1,1
if not rs.eof then
nnum=rs.recordcount-1
redim ndim(3,nnum)
for i=1 to nnum+1
ndim(0,i-1)=rs(0)
ndim(1,i-1)=rs(1)
ndim(2,i-1)=rs(2)
if tmpsort=ndim(0,i-1) then
nsort=tmpsort
ntit=ndim(1,i-1)
n_data_name=ndim(2,i-1)
end if
rs.movenext
next
if nsort="" then
nsort=ndim(0,0)
ntit=ndim(1,0)
n_data_name=ndim(2,0)
end if
ntits=ntit
ntit=ntit&tit_fir
end if
rs.close
end sub
sub joekoe_chk_erase()
if isarray(ndim) then erase ndim
end sub
sub server_select(n_sort,case_name)
dim temp,n_id,sql3,rs3
temp="<select name="&case_name&" size=1><option value='0'>请先选择...</option>"
sql3="select s_id,s_name from "&data_name&" where nsort='"&n_sort&"'"
set rs3=joekoe_cms.exec(sql3,1)
do while not rs3.eof
n_id=int(rs3(0))
temp=temp&vbcrlf&"<option value='"&n_id&"'>"&rs3(1)&"</option>"
rs3.movenext
loop
rs3.close
set rs3=nothing
response.write temp&"</select>"
end sub
sub music_sel_d_id()
dim temp
temp=" <select class=input name=c_id size=1>"
sql="select * from music_disk"
set rs=joekoe_cms.exec(sql,1)
Do while not rs.eof
temp=temp&"<option value='"&CStr(rs("id"))&"' name=c_id>"&rs("name")&"("&rs("singer")&")</option>"
rs.MoveNext
Loop
rs.close
response.write temp&"</select>"
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -