<!--#include file="../Include/conig.asp"-->
<!--#include file="Admin_check.asp"-->
<%
response.expires = 0 
response.expiresabsolute = now() - 1 
response.addHeader "pragma","no-cache" 
response.addHeader "cache-control","private" 
Response.cachecontrol = "no-cache"
if Instr(session("AdminPurview"),"|117,")=0 then 
  response.write ("<font color='red')>你不具有该管理模块的操作权限，请返回！</font>")
  response.end
end if
'========判断是否具有管理权限 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=gb2312" http-equiv="Content-Type">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<script language="javascript" src="Images/Disp.js"></script>
<link href="images/Admin_css.css" type=text/css rel=stylesheet>
<title>友情链接</title></head>
<body>
<% 
dim Result
Result=request.QueryString("Result")
dim ID,SiteName,LinkType,BigPic,Remark,LinkUrl
ID=request.QueryString("ID")
call FriendSiteEdit() 
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6298E1">
  <tr>
    <td height="24" nowrap background="images/th_bg.gif"><font color="#FFFFFF"><strong>友情链接：添加，修改友情链接</strong></font></td>
  </tr>
  <tr>
    <td height="24" align="center" nowrap  bgcolor="#EBF2F9"><a href="Admin_linkEdit.asp?Result=Add" >添加友情链接</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="Admin_linkList.asp" >查看友情链接</a></td>
  </tr>
</table>
<br>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6298E1">
  <form name="editForm" method="post" action="?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
  <tr>
    <td height="24" nowrap bgcolor="#EBF2F9"><table width="100%" border="0" cellpadding="0" cellspacing="0" id=editProduct idth="100%">

      <tr>
        <td width="160" height="20" align="right">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="20" align="right">站点名称：</td>
        <td><input name="SiteName" type="text" class="textfield" id="SiteName" style="WIDTH: 240;" value="<%=SiteName%>">&nbsp;*&nbsp;不少于3个字符</td>
      </tr>
      <tr>
        <td height="20" align="right">链接类型：</td>
        <td><input name="LinkType" type="radio" value="1" <%if LinkType=1 then response.write ("checked")%>/>图片&nbsp;<input name="LinkType" type="radio" value="0" <%if LinkType=0 then response.write ("checked")%>/>
        文字</td>
      </tr>
	  <tr>
        <td height="24" align="right"  valign="top">网站LOGO：</td>
        <td>
		<input name="BigPic" type="text" class="textfield" style="WIDTH: 240;" value="<%=BigPic%>" maxlength="100">
		<input type="checkbox" onClick="display('upload');" id="box"/><label for='box'>上传图片</label><br>
		<div id="upload" style="display:none;">			
		<iframe frameborder=0 width=290 height=25 scrolling=no src="Admin_upload.asp?action=pro"></iframe>
		</div>
		</td>
      </tr>
      <tr>
        <td height="20" align="right">链接网址：</td>
        <td><input name="LinkUrl" type="text" class="textfield" id="LinkUrl" style="WIDTH: 490;" value="<%=LinkUrl%>">&nbsp;*</td>
      </tr>
      <tr>
        <td height="20" align="right" valign="top">备注说明：
        <td><textarea name="Remark" rows="6" class="textfield" id="Remark" style="WIDTH: 490;"><%=Remark%></textarea></td>
      </tr>
      <tr>
        <td height="30" align="right">&nbsp;</td>
        <td valign="bottom"><input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 80;" ></td>
      </tr>
      <tr>
        <td height="20" align="right">&nbsp;</td>
        <td valign="bottom">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  </form>
</table>
</BODY>
</HTML>
<%
sub FriendSiteEdit()
  dim Action,rsCheckAdd,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then '保存编辑管理员
    set rs = server.createobject("adodb.recordset")
    if len(trim(request.Form("SiteName")))<0 then
      response.write ("<script language=javascript> alert('网站名称为必填项目且不少于2个字符！');history.back(-1);</script>")
      response.end
    end if
    if Result="Add" then '创建网站管理员
	  sql="select * from Web_rui_v_link"
      rs.open sql,conn,1,3
      rs.addnew
      rs("SiteName")=trim(Request.Form("SiteName"))
      rs("BigPic")=trim(Request.Form("BigPic"))
      rs("LinkUrl")=trim(Request.Form("LinkUrl"))
	  if Request.Form("LinkType")=1 then
        rs("LinkType")=1
	  else
        rs("LinkType")=0
	  end if	  
	  rs("Remark")=trim(Request.Form("Remark"))
	  rs("AddTime")=now()
	end if  
	if Result="Modify" then '修改网站管理员
      sql="select * from Web_rui_v_link where ID="&ID
      rs.open sql,conn,1,3
      rs("SiteName")=trim(Request.Form("SiteName"))
      rs("BigPic")=trim(Request.Form("BigPic"))
      rs("LinkUrl")=trim(Request.Form("LinkUrl"))
	  if Request.Form("LinkType")=1 then
        rs("LinkType")=1
	  else
        rs("LinkType")=0
	  end if	  
	  rs("Remark")=trim(Request.Form("Remark"))
	end if
	rs.update
	rs.close
    set rs=nothing 
    response.write "<script language=javascript> alert('成功编辑友情链接！');location.replace('Admin_LinkList.asp');</script>"
  else '提取
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from Web_rui_v_link where ID="& ID
      rs.open sql,conn,1,1
	  SiteName=rs("SiteName")
	  LinkType=rs("LinkType")
	  BigPic=rs("BigPic")
      LinkUrl=rs("LinkUrl")
      Remark=rs("Remark")
	  rs.close
      set rs=nothing 
	end if
  end if
end sub
%>