<!--#include file=conn.asp-->
<!--#include file=cookies.asp-->
<!--#include file="../inc/function.asp"-->
<%
dim rs,sql,id,i,str2,web,url,logo,webabout,jle
jle=request("jle")
id=trim(request("selectedid"))
if jle="del" then
if trim(id)="" then
response.write "<script language=JavaScript>" & chr(13) & "alert('没有选择记录！');" & "history.back()" & "</script>"
response.end
end if
str2=split(id,",")
set rs=server.createobject("adodb.recordset")
for i=0 to ubound(str2)
sql="select * from [link] where id="&cstr(str2(i))
rs.open sql,conn,1,1
'On Error Resume Next
rs.close
sql="delete from [link] where id="&cstr(str2(i))
rs.open sql,conn,1,3
next
response.write "<script language=JavaScript>" & chr(13) & "alert('删除链接成功！')</script>"
response.write "<meta http-equiv=refresh content=""1;URL=admin_link.asp"">"
response.end
rs.close
set rs=nothing
closedb
end if

if jle="yz" then
str2=split(id,",")
for i=0 to ubound(str2)
set rs=server.createobject("adodb.recordset")
sql="select yanz,jrsj from [link] where id="&trim(str2(i))
rs.open sql,conn,1,3
if rs("yanz")=0 then
rs("yanz")=1
rs("jrsj")=now()
rs.update
end if
next
response.write "<script language=JavaScript>" & chr(13) & "alert('记录已经通过验证！');" & "history.back()" & "</script>"
end if

if jle="editok" then
web=HtmlEncode(trim(request("web")))
url=HtmlEncode(trim(request("url")))
logo=HtmlEncode(trim(request("logo")))
webabout=HtmlEncodes(trim(request("webabout")))

id=trim(request("selectedid"))
str2=split(id,",")
for i=0 to ubound(str2)
set rs=server.createobject("adodb.recordset")
sql="select * from [link] where id="&trim(str2(i))
rs.open sql,conn,1,3
if rs("yanz")=1 then
rs("web")=web
rs("url")=url
rs("logo")=logo
rs("webabout")=webabout
rs("jrsj")=now()
rs.update
end if
next
response.write "<script language=JavaScript>" & chr(13) & "alert('链接修改成功！')</script>"
response.write "<meta http-equiv=refresh content=""1;URL=admin_link.asp"">"
end if

if jle="edit" then
id=trim(request("selectedid"))
if not isnumeric(id) or id="" then
response.write "<li>参数错误！"
response.end
end if
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [link] where id="&cstr(id) 
rs.open sql,conn,1,1
%> 
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改连接</title>
<link href="inc_style.css" rel="stylesheet" type="text/css">
</head>
<SCRIPT language=javascript>
<!--
function CheckForm()
{
if(document.thisForm.web.value.length<1)
	{
	    alert("网站名称不能为空!");
	    return false;
	}
	if(document.thisForm.url.value.length<1)
	{
	    alert("网站地址不能为空!");
	    return false;
	}
			if(document.thisForm.webabout.value.length<1)
	{
	    alert("网站简介不能为空!");
	    return false;
	}
}

//-->
</SCRIPT>
<body>
<form method="POST" name="thisForm" action="?selectedid=<%=id%>&jle=editok">
<div align=center>
<table width=400>
<tr>
<td>
<b>修改网站连接资料</b>
</td>
</tr>
<tr>
<td>
网站名称:<input type="text" name="web" size="30" maxlength="20" value="<%=rs("web")%>"> *
</td>
</tr>
<tr>
<td>
网站地址:<input type="text" name="url" size="30" value="<%=rs("url")%>"> *
</td>
</tr>
<tr>
<td>
logo地址:<input type="text" name="logo" size="36" value="<%=rs("logo")%>"> (88*31)
</td>
</tr>
<tr>
<td>
网站简介:<textarea rows="3" name="webabout" cols="44"><%=HtmlEncodex(rs("webabout"))%></textarea>*
</td>
</tr>
<tr>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit" onclick="javascript:return CheckForm();" value="确定修改" name="B1">
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
<%
rs.close
set rs=nothing
end if
closedb
%>