<% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="07"
	dir="../err.asp" 
  %>
  <!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
 <!--#include file="../rolecheck.asp"-->
  
<%
sub WriteErrMsg()
    response.write "<table align='center' width='300' border='0' cellpadding='2' cellspacing='0' class='border'>"
    response.write "<tr class='title'><td align='center' height='15'>错误提示</td></tr>"
    response.write "<tr class='tdbg'><td align='left' height='100'>" & errmsg & "<p align='center'>【<a href='javascript:onclick=history.back()'>返 回</a>】<br></p></td></tr>"
	response.write "</table>" 
end sub
function dvHTMLEncode(fString)
if not isnull(fString) then
    fString = replace(fString, ">", "&gt;")
    fString = replace(fString, "<", "&lt;")
    fString = Replace(fString, CHR(32), "&nbsp;")
    fString = Replace(fString, CHR(9), "&nbsp;")
     fString = Replace(fString, CHR(39), "&#39;")
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
    fString = Replace(fString, CHR(10), "<BR> ")

    dvHTMLEncode = fString
end if
end function

dim strFileName,MaxPerPage
MaxPerPage=20
dim totalPut,CurrentPage,TotalPages
dim sql,rs,ID,LinkType
dim Action,FoundErr,ErrMsg
Action=Replace_Text(request("Action"))
ID=Replace_Text(Request("ID"))
LinkType=Replace_Text(request("LinkType"))
strFileName="index.asp?LinkType=" & LinkType

if request("page")<>"" then
if not isnumeric(request("page")) then
    currentPage=1
else
	currentPage=cint(request("page"))
end if
end if
if ID<>"" then
	if Action="Check" then
		conn.execute "Update [yixiang_link] set IsOK=1 where linkID=" & CLng(ID)
	elseif Action="CancelCheck" then
		conn.execute "Update [yixiang_link] set IsOK=0 where linkID=" & CLng(ID)
	elseif Action="Good" then
		conn.execute "Update [yixiang_link] set IsGood=1 where linkID=" & CLng(ID)
	elseif Action="CancelGood" then
		conn.execute "Update [yixiang_link] set IsGood=0 where linkID=" & CLng(ID)
	elseif Action="Del" then
		conn.execute "Delete From [yixiang_link] where linkID=" & CLng(ID)
	end if
end if
%>
<html>
<head>
<title>
</title>
</head>
<SCRIPT language=javascript> 
<!-- Hide 
function killErrors() { 
return true; 
} 
window.onerror = killErrors; 
 // --> 
</SCRIPT> 
<script LANGUAGE="javascript">
function ConfirmDel()
{
   if(confirm("确定要删除此友情链接站点吗？"))
     return true;
   else
     return false;
}
</script><style type="text/css">
<!--
.tdc{filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#7194DB, EndColorStr=#A0B8E7);
}

body,td,th {
	font-size: 12px;
}
a {
	font-size: 12px;
	color: #003399;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #003399;
}
a:hover {
	text-decoration: underline;
	color: #FF6600;
}
a:active {
	text-decoration: none;
}
.STYLE1 {color: #FFFFFF}
-->
</style>
<body  topmargin="0"  bottommargin="0" >
 
	<table width="98%" border="1" bordercolor="#7698DD" align="center" cellpadding="0" cellspacing="0" Class="border">
  <tr > 
    <td height="25" align=center   class="tdc"><span class="STYLE1"><strong>友情链接管理</strong></span></td>
  </tr>
  <tr><td height="20">&nbsp;<a href="index.asp?Action=Add">添加友情连接</a>&nbsp;&nbsp;<a href="index.asp">所有友情连接</a></td>
  </tr>
</table>
 <%
if Action="Add" then
	call Add()
elseif Action="SaveAdd" then
	call SaveAdd()
elseif Action="Modify" then
	call Modify()
elseif Action="SaveModify" then
	call SaveModify()
else
	call main()
end if
if FoundErr=1 then
	call WriteErrMsg()
end if

sub main()
	sql="select * from [yixiang_link] where LinkType>0 "
	if LinkType<>"" then
		LinkType=CInt(LinkType)
		if LinkType=1 then
			sql=sql & " and LinkType=1 "
		elseif LinkType=2 then
			sql=sql & " and LinkType=2 "
		end if
	end if
	if Request("tj")=1 then sql=sql&" and isgood=1 "
	if Request("ws")=1 then sql=sql&" and IsOK=0 "
	sql=sql & " order by addtime desc"
	'response.write sql
	set rs=server.createobject("adodb.recordset")
	rs.open sql,conn,1,1
  	if rs.eof and rs.bof then
		response.write "目前共有 0 个友情链接"
	else
    	totalPut=rs.recordcount
		if currentpage<1 then
       		currentpage=1
    	end if
    	if (currentpage-1)*MaxPerPage>totalput then
	   		if (totalPut mod MaxPerPage)=0 then
	     		currentpage= totalPut \ MaxPerPage
		  	else
		      	currentpage= totalPut \ MaxPerPage + 1
	   		end if

    	end if
	    if currentPage=1 then
        	showContent
        	showpage strFileName,totalput,MaxPerPage,true,true,"个站点"
   	 	else
   	     	if (currentPage-1)*MaxPerPage<totalPut then
         	   	rs.move  (currentPage-1)*MaxPerPage
         		dim bookmark
           		bookmark=rs.bookmark
            	showContent
            	showpage strFileName,totalput,MaxPerPage,true,true,"个站点"
        	else
	        	currentPage=1
           		showContent
           		showpage strFileName,totalput,MaxPerPage,true,true,"个站点"
	    	end if
		end if
	end if
	rs.close
	set rs=nothing
end sub

sub showContent
   	dim i
    i=0
	if linktype="" then linktype=3
%>
 <table  border="1" bordercolor="#BBCDEE" cellpadding="0" cellspacing="0" align="center" width="98%">
 <tr><td>
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#F0F4FB" Class="border">
    <tr bgcolor="#82A3DF" class="title">
      <td width="61" height="22" align="center" class="STYLE1">链接类型</td>
      <td width="74" height="24" align="center"><span class="STYLE1">网站名称</span></td>
	  <% if linktype<>2 then %>
      <td width="99" height="22" align="center"><span class="STYLE1">网站LOGO</span></td>
	  <% end if %>
      <td width="155" height="22" align="center"><span class="STYLE1">网站简介</span></td>
      <td width="77" height="22" align="center"><span class="STYLE1">站长</span></td>
      <td width="66" height="22" align="center"><span class="STYLE1">状态</span></td>
      <td width="112" height="22" align="center"><span class="STYLE1">操作</span></td>
    </tr>
<%
do while not rs.eof
%>
    <tr   	  bgcolor="#FAFAFA" class="tdbg" onMouseOver="this.style.backgroundColor='#BFDFFF'" onMouseOut="this.style.backgroundColor=''">
      <td width="61" align="center">
	  <%
	  if rs("LinkType")=1 then
	  	response.write "<a href='index.asp?LinkType=1'><font color=blue>LOGO链接</font></a>"
	  else
		response.write "<a href='index.asp?LinkType=2'>文字链接</a>"
	  end if
	  %></td>
      <td width="74" height="22"><a href="<%=rs("SiteUrl")%>" target='blank' title="<%=rs("SiteUrl")%>"><%=rs("SiteName")%></a></td>
      <% if linktype<>2 then %>
	  <td width="99" align="center">
<%
if rs("imageurl")<>"" and rs("imageurl")<>"http://" and rs("LinkType")=1 then
	if lcase(right(rs("imageurl"),3))="swf" then
		Response.Write "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='88' height='31'><param name='movie' value='" & rs("imageurl") & "'><param name='quality' value='high'><embed src='" & rs("imageurl") & "' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='88' height='31'></embed></object>"
	else
		response.write "<a href='" & rs("SiteUrl") & "' target='_blank' title='" & rs("imageurl") & "'><img src='" & rs("imageurl") & "' width='88' height='31' border='0'></a>"
	end if
else
	response.write "&nbsp;"
end if
%> </td>
<% end if %>
      <td width="155"><%=rs("SiteIntro")%></td>
      <td width="77" align="center"><a href="mailto:<%=rs("Email")%>"><%=rs("SiteAdmin")%></a></td>
      <td width="66" align="center"> <%
	  if rs("IsOK")=1 then
	  	response.write "<font color=blue>已审核</font>"
	  else
	    response.write "&nbsp;"
	  end if
	  if rs("IsGood")=1 then
	  	response.write "<br><font color=red>推荐</font>"
	  end if
	  %> </td>
      <td width="112" align="center"> <%
	  If rs("IsOK")=0 Then 
        response.write "<a href='index.asp?ID=" & rs("linkid") & "&Action=Check'><font color=blue>审核通过</font></a>&nbsp;&nbsp;"
      Else
        response.write "<a href='index.asp?ID=" & rs("linkid") & "&Action=CancelCheck'>取消审核</a>&nbsp;&nbsp;"
      End If
	  response.write "<a href='index.asp?Action=Modify&ID=" & rs("linkid") & "'>修改</a><br>"
	  if rs("IsGood")=0 then
        response.write "<a href='index.asp?ID=" & rs("linkid") & "&Action=Good'><font color=green>设为推荐</font></a>&nbsp;&nbsp;"
      Else
        response.write "<a href='index.asp?ID=" & rs("linkid") & "&Action=CancelGood'>取消推荐</a>&nbsp;&nbsp;"
      End If
      response.write "<a href='index.asp?Action=Del&ID=" & rs("linkid") & "' onclick='return ConfirmDel();'>删除</a>"
	  %> </td>
    </tr>
    <%
	i=i+1
	if i>=MaxPerPage then exit do
	rs.movenext
loop
%>
</table></td></tr></table>	
<%
end sub

sub Add()
%>
<form method="post" name="msform" onSubmit="return Check()" action="index.asp">
 <table  border="1" bordercolor="#BBCDEE" cellpadding="0" cellspacing="0" align="center" width="98%">
 <tr><td>
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#F7F7F7" class="border">
    <tr class="title"> 
      <td height="25" colspan="2" align="center" bgcolor="#AFCBF5">添加友情链接</td>
    </tr>
    <tr class="tdbg"> 
      <td width="248" height="25" align="center"><strong>链接类型：</strong></td>
      <td width="677" height="25"><input name="LinkType" type="radio" onClick="logoshow()" value="1" checked>
        Logo链接&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" onClick="wenzi()" name="LinkType" value="2">
      文字链接</td>
    </tr>
	<script language=vbscript>
	sub wenzi()
	logoa.style.display="none"
	end sub
	sub logoshow()
	logoa.style.display=""
	end sub
	</script>
    <tr class="tdbg"> 
      <td width="248" height="25" align="center" valign="middle"><strong>网站名称：</strong></td>
      <td height="25"> <input name="SiteName" size="30"  maxlength="20" title="这里请输入您的网站名称，最多为20个汉字"> 
        <font color="#FF0000"> *</font></td>
    </tr>
    <tr class="tdbg"> 
      <td width="248" height="25" align="center"><strong>网站地址：</strong></td>
      <td height="25"> <input name="SiteUrl" size="30"  maxlength="100" type="text"  value="http://" title="这里请输入您的网站地址，最多为50个字符，前面必须带http://"> 
        <font color="#FF0000">*</font></td>
    </tr>
    <tr class="tdbg" id=logoa> 
      <td width="248" height="25" align="center"><strong>网站Logo：</strong></td>
      <td height="25"> <input name="fujian" size="30"  maxlength="100" type="text"  value="http://" title="这里请输入您的网站imageurl地址，最多为50个字符，如果您在第一选项选择的是文字链接，这项就不必填"></td>
    </tr>
	
    <tr class="tdbg"> 
      <td width="248" height="25" align="center"><strong>站长姓名：</strong></td>
      <td height="25"> <input name="SiteAdmin" size="30"  maxlength="20" type="text"  title="这里请输入您的大名了，不然我知道您是谁啊。最多为20个字符"></td>
    </tr>
    <tr class="tdbg"> 
      <td width="248" height="25" align="center"><strong>电子邮件：</strong></td>
      <td height="25"> <input name="Email" size="30"  maxlength="30" type="text" title="这里请输入您的联系电子邮件，最多为30个字符"></td>
    </tr>
    <tr class="tdbg"> 
      <td width="248" align="center"><strong>网站简介：</strong></td>
      <td valign="middle"> <textarea name="SiteIntro" cols="40" rows="5" id="SiteIntro" title="这里请输入您的网站的简单介绍"></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td width="248" height="25" align="center"><strong>推荐站点：</strong></td>
      <td height="25" valign="middle"> <input name="IsGood" type="radio" value="1" checked>
        是&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="IsGood" value="0">
        否</td>
    </tr>
    <tr class="tdbg"> 
      <td width="248" height="25" align="center"><strong>审核通过：</strong></td>
      <td height="25" valign="middle"><input name="IsOK" type="radio" value="1" checked>
        是&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="IsOK" value="0">
        否</td>
    </tr>
    <tr class="tdbg"> 
      <td height="40" colspan="2" align="center"><input name="Action" type="hidden" id="Action" value="SaveAdd"> 
        <input type="submit" value=" 添 加 " name="cmdOk"> 
        &nbsp; <input type="reset" value=" 取 消 " name="cmdReset">      </td>
    </tr>
  </table>
  </td></tr></table>
</form>
<%
end sub

sub Modify()
	if ID="" then
		FoundErr=1
		ErrMsg=ErrMsg & " 请指定友情站点ID "
		exit sub
	else
		ID=Clng(ID)
	end if
	dim sqlLink,rsLink
	sqlLink="select * from [yixiang_link] where linkID=" & ID
	set rsLink=Server.CreateObject("Adodb.RecordSet")
	rsLink.open sqlLink,conn,1,3
	if rsLink.bof and rsLink.eof then
		FoundErr=1
		ErrMsg=ErrMsg & " 找不到站点！ "
		rsLink.close
		set rsLink=nothing
		exit sub
	end if

%>
<form method="post" name="msform" onSubmit="return Check()" action="index.asp">
 <table  border="1" bordercolor="#BBCDEE" cellpadding="0" cellspacing="0" align="center" width="98%">
 <tr><td>
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FAFAFA" class="border">
    <tr class="title"> 
      <td height="22" colspan="2" align="center" bgcolor="#AFCBF5">修改友情链接信息</td>
    </tr>
    <tr class="tdbg"> 
      <td width="244" height="25" align="center"><strong>链接类型：</strong></td>
      <td width="681" height="25"><input name="LinkType" type="radio" onClick="logoshow()" value="1" <%if rsLink("LinkType")=1 then response.write "checked"%>>
        Logo链接&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" onClick="wenzi()" name="LinkType" value="2" <%if rsLink("LinkType")=2 then response.write "checked"%>>
      文字链接</td>
    </tr>
	<script language=vbscript>
	sub wenzi()
	logoa.style.display="none"
	end sub
	sub logoshow()
	logoa.style.display=""
	end sub
	</script>
    <tr class="tdbg"> 
      <td height="25" align="center" valign="middle"><strong>网站名称：</strong></td>
      <td height="25"> <input name="SiteName" title="这里请输入您的网站名称，最多为20个汉字" value="<%=rsLink("SiteName")%>" size="30"  maxlength="20"> 
        <font color="#FF0000"> *</font></td>
    </tr>
    <tr class="tdbg"> 
      <td height="25" align="center"><strong>网站地址：</strong></td>
      <td height="25"> <input name="SiteUrl" size="30"  maxlength="100" type="text"  value="<%=rsLink("SiteUrl")%>" title="这里请输入您的网站地址，最多为50个字符，前面必须带http://"> 
        <font color="#FF0000">*</font></td>
    </tr>
    <tr class="tdbg" id=logoa <%if rsLink("LinkType")=2 then response.write "style='display:none'"%>> 
      <td height="25" align="center"><strong>网站Logo：</strong></td>
      <td height="25"> <input name="fujian" size="30"  maxlength="100" type="text"  value="<%=rsLink("imageurl")%>" title="这里请输入您的网站imageurl地址，最多为50个字符，如果您在第一选项选择的是文字链接，这项就不必填"></td>
    </tr>
	<script language="vbscript">
sub shan()
if ss.style.display="" then
ss.style.display="none"
else
ss.style.display=""
end if
end sub
</script>
    <tr class="tdbg"> 
      <td height="25" align="center"><strong>站长姓名：</strong></td>
      <td height="25"> <input name="SiteAdmin" type="text"  title="这里请输入您的大名了，不然我知道您是谁啊。最多为20个字符" value="<%=rsLink("SiteAdmin")%>" size="30"  maxlength="20"></td>
    </tr>
    <tr class="tdbg"> 
      <td height="25" align="center"><strong>电子邮件：</strong></td>
      <td height="25"> <input name="Email" size="30"  maxlength="30" type="text"  value="<%=rsLink("Email")%>" title="这里请输入您的联系电子邮件，最多为30个字符"></td>
    </tr>
    <tr class="tdbg"> 
      <td align="center"><strong>网站简介：</strong></td>
      <td valign="middle"> <textarea name="SiteIntro" cols="40" rows="5" id="SiteIntro" title="这里请输入您的网站的简单介绍"><%=rsLink("SiteIntro")%></textarea></td>
    </tr>
    <tr class="tdbg">
      <td height="25" align="center"><span style="font-weight: bold">加入时间：</span></td>
      <td height="25" valign="middle"><%=rsLink("addtime")%></td>
    </tr>
    <tr class="tdbg"> 
      <td height="25" align="center"><strong>推荐站点：</strong></td>
      <td height="25" valign="middle"> <input name="IsGood" type="radio" value="1" <%if rsLink("IsGood")=1 then response.write "checked"%>>
        是&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="IsGood" value="0" <%if rsLink("IsGood")=0 then response.write "checked"%>>
        否</td>
    </tr>
    <tr class="tdbg"> 
      <td height="25" align="center"><strong>审核通过：</strong></td>
      <td height="25" valign="middle"><input name="IsOK" type="radio" value="1" <%if rsLink("IsOK")=1 then response.write "checked"%>>
        是&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="IsOK" value="0" <%if rsLink("IsOK")=0 then response.write "checked"%>>
        否</td>
    </tr>
    <tr class="tdbg"> 
      <td height="40" colspan="2" align="center"><input name="ID" type="hidden" id="ID" value="<%=rsLink("linkID")%>"> 
        <input name="Action" type="hidden" id="Action" value="SaveModify"> <input type="submit" value=" 确 定 " name="cmdOk">      </td>
    </tr>
  </table>
  </td></tr></table>
</form>
<%
	rsLink.close
	set rsLink=nothing
end sub
%></body>
</html>
<%

sub SaveAdd()
	dim LinkType,LinkSiteName,LinkSiteUrl,Linkimageurl,LinkSiteAdmin,LinkEmail,LinkSitePassword,LinkSitePwdConfirm,LinkSiteIntro,LinkIsGood,LinkIsOK
	LinkType=Replace_Text(request("LinkType"))
	LinkSiteName=Replace_Text(request("SiteName"))
	LinkSiteUrl=Replace_Text(request("SiteUrl"))
	Linkimageurl=Replace_Text(request("fujian"))
	LinkSiteAdmin=Replace_Text(request("SiteAdmin"))
	LinkEmail=Replace_Text(request("Email"))
	LinkSitePassword=Replace_Text(request("SitePassword"))
	LinkSitePwdConfirm=Replace_Text(request("SitePwdConfirm"))
	LInkSiteIntro=Replace_Text(request("SiteIntro"))
	LinkIsGood=Replace_Text(request("IsGood"))
	LinkIsOK=Replace_Text(request("IsOK"))
	if LinkType="" then
		FoundErr=1
		ErrMsg=ErrMsg & "链接类型不能为空！"
	else
		LinkType=Cint(LinkType)
		if LinkType=1 and (Linkimageurl="" or Linkimageurl="http://") then
			FoundErr=1
			ErrMsg=ErrMsg & "网站LOGO不能为空！"
		end if
	end if
	if LinkSiteName="" then
		FoundErr=1
		ErrMsg=ErrMsg & "网站名称不能为空！"
	end if
	if LinkSiteUrl="" then
		FoundErr=1
		ErrMsg=ErrMsg & "网站地址不能为空！"
	end if
	if LinkEmail<>"" then
		if IsValidEmail(LinkEmail)=0 then
			errmsg=errmsg & "Email地址错误!"
	   		founderr=1
		end if
	end if

	if FoundErr<>1 then
		dim sqlLink,rsLink
		sqlLink="select top 1 * from [yixiang_link] where SiteName='" & dvHtmlEncode(LinkSiteName) & "' and SiteUrl='" & dvHtmlEncode(LinkSiteUrl) & "'"
		set rsLink=Server.CreateObject("Adodb.RecordSet")
		rsLink.open sqlLink,conn,1,3
		if not (rsLink.bof and rsLink.eof) then
			FoundErr=1
			ErrMsg=ErrMsg & "你要添加的网站已经存在！"
		else
			rsLink.Addnew
			rsLink("LinkType")=LinkType
			rsLink("SiteName")=dvHtmlEncode(LinkSiteName)
			rsLink("SiteUrl")=dvHtmlEncode(LinkSiteUrl)
			rsLink("imageurl")=dvHtmlEncode(Linkimageurl)
			rsLink("SiteAdmin")=dvHtmlEncode(LinkSiteAdmin)
			rsLink("Email")=dvHtmlEncode(LinkEmail)
			rsLink("SiteIntro")=dvHtmlEncode(LinkSiteIntro)
			rsLink("IsGood")=LinkIsGood
			rsLink("IsOK")=LinkIsOK
			rsLink.update
			rsLink.close
			set rsLink=nothing
			conn.close()
			Set conn=nothing
			Response.write "<script>alert('添加成功！');location.href='index.asp'</script>"
			Response.end
		end if
	Else
		conn.close()
		Set conn=nothing
		Response.write "<script>alert('"&errmsg&"');history.back();</script>"
		response.end
	end if
end sub

sub SaveModify()
	if ID="" then
		FoundErr=1
		ErrMsg=ErrMsg & " 请指定友情站点ID "
		exit sub
	else
		ID=Clng(ID)
	end if
	dim LinkType,LinkSiteName,LinkSiteUrl,Linkimageurl,LinkSiteAdmin,LinkEmail,LinkSitePassword,LinkSitePwdConfirm,LinkSiteIntro,LinkIsGood,LinkIsOK
	LinkType=Replace_Text(request("LinkType"))
	LinkSiteName=Replace_Text(request("SiteName"))
	LinkSiteUrl=Replace_Text(request("SiteUrl"))
	Linkimageurl=Replace_Text(request("fujian"))
	LinkSiteAdmin=Replace_Text(request("SiteAdmin"))
	LinkEmail=Replace_Text(request("Email"))
	LinkSitePassword=Replace_Text(request("SitePassword"))
	LinkSitePwdConfirm=Replace_Text(request("SitePwdConfirm"))
	LInkSiteIntro=Replace_Text(request("SiteIntro"))
	LinkIsGood=Replace_Text(request("IsGood"))
	LinkIsOK=Replace_Text(request("IsOK"))
	if LinkType="" then
		FoundErr=1
		ErrMsg=ErrMsg & "链接类型不能为空！"
	else
		LinkType=Cint(LinkType)
		if LinkType=1 and (Linkimageurl="" or Linkimageurl="http://") then
			FoundErr=1
			ErrMsg=ErrMsg & "网站LOGO不能为空！"
		end if
	end if
	if LinkSiteName="" then
		FoundErr=1
		ErrMsg=ErrMsg & "网站名称不能为空！"
	end if
	if LinkSiteUrl="" then
		FoundErr=1
		ErrMsg=ErrMsg & "网站地址不能为空！"
	end if
	if FoundErr=1 then
		exit sub
	end if
	dim sqlLink,rsLink
	sqlLink="select * from [yixiang_link] where linkID=" & ID
	set rsLink=Server.CreateObject("Adodb.RecordSet")
	rsLink.open sqlLink,conn,1,3
	if rsLink.bof and rsLink.eof then
		FoundErr=1
		ErrMsg=ErrMsg & "找不到站点！"
	else
		rsLink("LinkType")=LinkType
		rsLink("SiteName")=dvHtmlEncode(LinkSiteName)
		rsLink("SiteUrl")=dvHtmlEncode(LinkSiteUrl)
		rsLink("imageurl")=dvHtmlEncode(Linkimageurl)
		rsLink("SiteAdmin")=dvHtmlEncode(LinkSiteAdmin)
		rsLink("Email")=dvHtmlEncode(LinkEmail)
		if LinkSitePassword<>"" then
			rsLink("SitePassword")=md5(LinkSitePassword)
		end if
		rsLink("SiteIntro")=dvHtmlEncode(LinkSiteIntro)
		if LinkIsGood="" then LinkIsGood=0
		rsLink("IsGood")=LinkIsGood
		rsLink("IsOK")=LinkIsOK
		rslink("addtime")=now()
		rsLink.update
		rsLink.close
		set rsLink=nothing
		Response.Redirect "index.asp"
	end if
	rsLink.close
	set rsLink=nothing
end sub
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
	dim n, i,strTemp,strUrl
	if totalnumber mod maxperpage=0 then
    	n= totalnumber \ maxperpage
  	else
    	n= totalnumber \ maxperpage+1
  	end if
  	strTemp= "<table align='center'><tr><td>"
	if ShowTotal=true then 
		strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & "&nbsp;&nbsp;"
	end if
	strUrl=JoinChar(sfilename)
  	if CurrentPage<2 then
    		strTemp=strTemp & "首页 上一页&nbsp;"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "page=1'>首页</a>&nbsp;"
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "'>上一页</a>&nbsp;"
  	end if

  	if n-currentpage<1 then
    		strTemp=strTemp & "下一页 尾页"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "'>下一页</a>&nbsp;"
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & n & "'>尾页</a>"
  	end if
   	strTemp=strTemp & "&nbsp;页次：<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
    strTemp=strTemp & "&nbsp;<b>" & maxperpage & "</b>" & strUnit & "/页"
	if ShowAllPages=True then
		strTemp=strTemp & "&nbsp;转到：<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "page=" & "'+this.options[this.selectedIndex].value;"">"   
    	for i = 1 to n   
    		strTemp=strTemp & "<option value='" & i & "'"
			if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
			strTemp=strTemp & ">第" & i & "页</option>"   
	    next
		strTemp=strTemp & "</select>"
	end if
	strTemp=strTemp & "</td></tr></table>"
	response.write strTemp
end sub
function JoinChar(strUrl)
	if strUrl="" then
		JoinChar=""
		exit function
	end if
	if InStr(strUrl,"?")<len(strUrl) then 
		if InStr(strUrl,"?")>1 then
			if InStr(strUrl,"&")<len(strUrl) then 
				JoinChar=strUrl & "&"
			else
				JoinChar=strUrl
			end if
		else
			JoinChar=strUrl & "?"
		end if
	else
		JoinChar=strUrl
	end if
end function
'检查Email
function IsValidEmail(email)
	dim names, name, i, c
	IsValidEmail = true
	names = Split(email, "@")
	if UBound(names) <> 1 then
	   IsValidEmail = false
	   exit function
	end if
	for each name in names
		if Len(name) <= 0 then
			IsValidEmail = false
    		exit function
		end if
		for i = 1 to Len(name)
		    c = Lcase(Mid(name, i, 1))
			if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
		       IsValidEmail = false
		       exit function
		     end if
	   next
	   if Left(name, 1) = "." or Right(name, 1) = "." then
    	  IsValidEmail = false
	      exit function
	   end if
	next
	if InStr(names(1), ".") <= 0 then
		IsValidEmail = false
	   exit function
	end if
	i = Len(names(1)) - InStrRev(names(1), ".")
	if i <> 2 and i <> 3 then
	   IsValidEmail = false
	   exit function
	end if
	if InStr(email, "..") > 0 then
	   IsValidEmail = false
	end if
end function
conn.close
set conn=nothing
%>
 
 
</body></html>

