<%@language="vbscript" codepage="936" %>
<%path="../basedata"%>
<!--#include file="../conn/conn_link.asp"-->
<!--#include file="../inc/function.asp"-->
<%call Loginpower%>
<%call Legalpower%>
<%
dim urlhttp,urlname,highlink,actionvalue,strid,strdel

urlhttp=request.form("urlhttp")
urlname=server.HTMLencode(request.form("urlalias"))
highlink=request.form("highlink")
actionvalue=request.querystring("action")
strid=int(request.form("id"))
strdel=request.querystring("del")

dim sql,rs

set rs=server.createobject("adodb.recordset")
sql="select * from url where url_identify='no' order by url_id desc"
'---------------------------------
	if actionvalue="增加" then
		set rs1=conn_link.execute("select * from url where url_alias='"&urlname&"'")
		if rs1.eof and rs1.bof then
			sql="select * from url"
			rs.open sql,conn_link,2,3

			rs.addnew
			rs("url_dl_http")=urlhttp
			rs("url_alias")=urlname
			rs("url_identify")="no"
			rs.update

			rs.close
			set rs=nothing
			conn_link.close
			set conn_link=nothing
			response.write msgok("增加成功","?")
			response.end
		else
			set rs=nothing
			conn_link.close
			set conn_link=nothing
			response.write errorback("有重复别名存在……")
			response.end
		end if
	end if
'---------------------------------

	if actionvalue="修改" then
		if not idboolean(strid) then response.redirect "?":response.end
		set rs1=conn_link.execute("select * from url where url_alias='"& urlname &"' and url_id not in("&strid&")" )
		if rs1.eof and rs1.bof then
			sql="select * from url where url_id="&strid
			rs.open sql,conn_link,2,3

			rs("url_dl_http")=urlhttp
			rs("url_alias")=urlname
			if highlink="ok" then rs("url_identify")="yes"

			rs.update

			rs.close
			set rs=nothing
			conn_link.close
			set conn_link=nothing
			if highlink="ok" then
				response.write msgok("成功转为高级盗连，请修改地址！","Advanced_manager.asp")
				response.end
			else
				response.write msgok("修改成功","?")
				response.end
			end if
		else
			set rs=nothing
			conn_link.close
			set conn_link=nothing
			response.write msgok("有重复别名存在……","?")
			response.end
		end if
	end if
'---------------------------------

if idboolean(strdel) and actionvalue="删除" then
conn_link.execute("delete from url where url_identify='no' and url_id="&strdel)
conn_link.close
set conn_link=nothing
response.write msgok("删除成功","?")
response.end
end if
'---------------------------------
%>
<!-- #include file="../Inc/Head.asp" -->
<script language="javascript">
function check()
{
if (document.form1.urlhttp.value=="")
{
alert("地址不能为空");
document.form1.urlhttp.focus();
return false;
}

if (document.form1.urlalias.value=="")
{
alert("别名不能为空");
document.form1.urlalias.focus();
return false;
}
}
</script>
<br/><br/><br/><br/>
<div style="text-align:center;">
<table border="1" bordercolor="#A5B6D6" cellpadding="0" cellspacing="2" class="center">
  <tr>
    <td height="27" colspan="6" class="southidc" style="text-align:center;color:#000000;font-weight:bold; ">普通外连地址</td>
  </tr>
  <tr class="tr_southidc">
      <td width="34" height="20" class="center">id</td>
    <td width="200" class="center">总地址</td>
    <td width="194" class="center">别名</td>
    <td width="100" class="center">操作</td>
  </tr>

  <%
  rs.open sql,conn_link,1,1
  if rs.eof then
  %>
    <tr class="tr_southidc">
    <td height="20" colspan="6" width="500px" style="text-align:center;color:#000000;">没有数据……</td>
  </tr>
  <%
  else
  do while not rs.eof
  if rs.eof then exit do
  %>
    <tr>
  <form name="form" method="post" action="?action=修改">
      <td height="30">
    [<%=rs("url_id")%>]
    </td>
    <td height="30">
<input type="text" name="urlhttp" size="30" value="<%=rs("url_dl_http")%>">
       [<a href="?urlid=<%=rs("url_id")%>">歌曲</a>]&nbsp;
    </td>
    <td>
    <input type="text" name="urlalias" value="<%=rs("url_alias")%>">&nbsp;<input title="转到高级盗连" type="checkbox" value="ok" name="highlink">
    </td>
    <td>
    <input type="hidden" value="<%=rs("url_id")%>" name="id">
    <input class="submit" type="submit" name="Submit" value="修改">&nbsp;<a href="?del=<%=rs("url_id")%>&action=删除">删除</a>
    </td>
	</form>
  </tr>
  <%
  rs.movenext
  loop
  end if
rs.close
set rs=nothing
conn_link.close
set conn_link=nothing

%>

</table><p></p>
<table width="560" border="1" bordercolor="#A5B6D6" cellpadding="0" cellspacing="2" class="center">
  <tr>
    <td height="27" colspan="5" class="back_southidc" style="text-align:center;color:#000000;font-weight:bold; ">增加</td>
  </tr>
  <tr class="tr_southidc">
    <td width="234" height="20" class="center">总地址</td>
    <td width="174" class="center">别名</td>
    <td width="85" class="center">操作</td>
  </tr>
  <tr>
  <form name="form1" method="post" action="?action=增加" onsubmit="return check()">
    <td height="20">
    <input type="text" name="urlhttp" size="30">
    </td>
    <td>
    <input type="text" name="urlalias">
    </td>
    <td>
    <input class="submit" type="submit" name="Submit" value="增加">
    </td>
	</form>
  </tr>

</table>
</div>
<!-- #include file="../Inc/Foot.asp" -->
