<!--#include file="Admin.asp" -->
<!--#include file="cf.asp" -->
<!--#include file="adminconn.asp" -->
<!--#include file="../include/safe.asp"-->
<%
'==================================




function htmls(shtml)
	dim objregexp, shtmls
	set objregexp = new regexp
	objregexp.ignorecase = true
	objregexp.global = true
	objregexp.pattern = "<.+?>"
	shtmls = objregexp.replace(shtml, "")
	htmls = shtmls
	set objregexp = nothing
end function

function encodestr(str)
	dim i
	str=trim(str)
	str=replace(str,"<","&lt;")
	str=replace(str,">","&gt;")
	str=replace(str,"'","""")
	str=replace(str,vbcrlf&vbcrlf,"</p><p>")
	str=replace(str,vbcrlf,"<br>")
	htmlencode = str
	encodestr=replace(str," ","")
	encodestr=replace(str,"&nbsp;","")
	if isnumeric(encodestr) then
        str=encodestr
    else
        str=0
    end if
end function %>
<%
if session("aleave")="check" then
response.write"<script language=javascript>alert('对不起，你没有这个权限！');"
response.write"javascript:history.go(-1)</script>"
response.end
end if
%>
<html>
<head>
<title>友情链接</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../include/css.css" type="text/css">
</head>
<body>

<%if request("action")="" then%>
      </p>
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td align="center"><iframe id="datamain" src="adminlinks.asp" width=674 height=380 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no ></iframe> 
           <script language="javascript">
<!-- hide
function gohist(a) {
   history.go(a);
}
//-->
</script></td>
        </tr>
      </table>
<%elseif request("action")="edit" then%>
<%
dim id
id=htmls(encodestr(request("id")))
strsql = "select * from sogo_link where id="&id
set rs = server.createobject("adodb.recordset")
rs.open strsql,conn,1,1
if rs.eof then
response.write"<script>alert('很抱歉，没有您所需要的数据！~`');</script>"
response.write "<script>history.go(-1);</script>"
response.end()
else
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
          <td bgcolor="#ffffff"><table width=86% align=center border=0 cellpadding=0 cellspacing=1 bgcolor=#ff9900><tr><td bgcolor=#ffffff> 
            <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#f3f3f3">
                    <form name="addlink" action="?action=editok&id=<%=id%>" method="post">
                <script language=javascript>
   function confirm_button(){
	if (confirm("是否要删除？")){
		return true;
	}
	return false;
	}
</script>
                      <tr bgcolor="#ff9900"> 
                        <td height="30" colspan="2"><font color="#ffffff"><font color="#ffffff">　　&raquo;   
                          <b>修改友情链接</b></font>[<b><%=rs("sogo_link_font")%></b>]　</font></td>
                </tr>
                <tr> 
                  <td width="200" align="right">
                  　网站名称： </td>
                  <td width="599"><input name="t1" type="text" id="t13" value="<%=rs("sogo_link_font")%>"></td>
                </tr>
				<tr> 
                  <td width="200" align="right">
                  　显示排序： </td>
                  <td width="599"><input name="t0" type="text" id="t1" value="<%=rs("link_paixu")%>"></td>
                </tr>
                <tr> 
                  <td align="right">链接类型： </td>
                  <td width="599"><label> 
                    <input name="logoortxt" type="radio" value="0" <%if rs("sogo_link_logo_or_txt")=0 then%>checked<%end if%>>
                    图片链接</label> <label> 
                    <input type="radio" name="logoortxt" value="1" <%if rs("sogo_link_logo_or_txt")=1 then%>checked<%end if%>>
                  文字链接</label> </td>
                </tr>
                <tr> 
                  <td align="right">　　连接地址： </td>
                  <td><input name="t2" type="text" id="t23" value="<%=rs("sogo_link_url")%>" size="60"></td>
                </tr>
                <tr> 
                  <td align="right">　　logo图标： </td>
                  <td align="left"><table width="100%"><tr><td width="50%" align="left"><input name="pic_url" type="text" id="pic_url" size="30" maxlength="255" value=" <%=rs("sogo_link_login")%>"></td><td width="30%" align="left"><iframe border=0 frameborder=0 framespacing=0 height=22  marginheight=0 marginwidth=0 name=new_date noresize scrolling=no  src="upload3.asp" vspale="0"></iframe></td></tr></table></td>
                </tr>
                <tr> 
                  <td align="right" valign="top">站点说明：</td>
                  <td><textarea name="t4" cols="60" rows="5" id="t4"><%=rs("sogo_link_alt")%></textarea></td>
                </tr>
                <tr> 
                  <td colspan="2"> <div align="right"><a href="?action=delete&id=<%=id%>" onClick="return confirm_button()"><font color="#ff0000">【删除此链接】</font></a>　<%if rs("sogo_link_yes_no")=0 then%><a href="?action=ok&id=<%=id%>"><font color="#ff0000">【审核通过】</font></a><%else%><a href="?action=no&id=<%=id%>"><font color="#ff0000">【待审核】</font></a><%end if%>
                            <input type="submit" name="submit" value=" 修 改 ">   
                    </div></td>
                </tr>
              </form>
            </table>
        </td>
    </tr>
</table>
        </td>
    </tr>
</table>
<%
end if
'修改
elseif request("action")="editok" then
id=htmls(encodestr(request("id")))
strsql = "select * from sogo_link where id="&id
set rs = server.createobject("adodb.recordset")
rs.open strsql,conn,1,2
rs("sogo_link_font")=htmls(encodestr(request("t1")))
rs("sogo_link_url")=htmls(encodestr(request("t2")))
rs("sogo_link_login")=htmls(encodestr(request("pic_url")))
rs("sogo_link_alt")=htmls(encodestr(request("t4")))
rs("link_paixu")=htmls(encodestr(request("t0")))
rs("sogo_link_logo_or_txt")=htmls(encodestr(request("logoortxt")))
rs.update
rs.close
response.redirect("admin_links.asp")
'通过审核
elseif request("action")="ok" then
id=htmls(encodestr(request("id")))
strsql = "select * from sogo_link where id="&id
set rs = server.createobject("adodb.recordset")
rs.open strsql,conn,1,2
rs("sogo_link_yes_no")=1
rs.update
rs.close
response.redirect("admin_links.asp")
'待审核
elseif request("action")="no" then
id=htmls(encodestr(request("id")))
strsql = "select * from sogo_link where id="&id
set rs = server.createobject("adodb.recordset")
rs.open strsql,conn,1,2
rs("sogo_link_yes_no")=0
rs.update
rs.close
response.redirect("admin_links.asp")
'添加
elseif request("action")="add" then  
if request("t1")="" or len(request("t1"))>36 or len(request("t1"))<3 or request("t2")="" or request("pic_url")="" or left(request("t2"),7)<>"http://" or len(request("t2"))<12 or len(request("t2"))>100 or left(request("t3"),7)<>"http://" or len(request("pic_url"))>160 or len(request("pic_url"))<6 or request("t4")="" or len(request("t4"))>255 or len(request("t4"))<2  then
response.write"<script>alert('很抱歉，请正确、完整的填写链接信息！~`');</script>"
response.write "<script>history.go(-1);</script>"
response.end()
end if

strsql = "select * from sogo_link"
set rs = server.createobject("adodb.recordset")
rs.open strsql,conn,1,2
rs.addnew
rs("sogo_link_font")=htmls(encodestr(request("t1")))
rs("sogo_link_url")=htmls(encodestr(request("t2")))
rs("sogo_link_login")=htmls(encodestr(request("pic_url")))
rs("sogo_link_alt")=htmls(encodestr(request("t4")))
rs("link_paixu")=htmls(encodestr(request("t0")))
rs("sogo_link_logo_or_txt")=htmls(encodestr(request("logoortxt")))
rs("sogo_link_yes_no")=1
rs.update
rs.close
response.redirect("admin_links.asp")
'删除
elseif request("action")="delete" then
id=htmls(encodestr(request("id")))
conn.execute("delete * from sogo_link where id=" & id)
response.redirect("admin_links.asp")
end if
%></td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

                                                              
                                                              
                                                              