<% Option Explicit %>
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Const.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
'==============================================================================
'软件名称：风讯网站信息管理系统
'当前版本：Foosun Content Manager System 2.0 
'最新更新：2004.12
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071,66252421
'技术支持:所有程序使用问题，请提问到bbs.foosun.net我们将及时回答您
'程序开发：风讯开发组 & 风讯插件开发组
'论坛支持：风讯在线论坛(http://bbs.foosun.net)
'官方网站：www.Foosun.net  演示站点：test.cooin.com    
'网站建设专区：www.cooin.com
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'==============================================================================
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P119") then Call ReturnError()
%>
<html>
<head>
<link rel="stylesheet" href="../Inc/ModeWindow.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>友情链接管理</title>
</head>
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<body topmargin="0" leftmargin="0">
<form action="" method = "post" name ="FLForm">
  <table width="100%" border="0" cellspacing="5" cellpadding="0">
    <tr> 
      <td height="8" colspan="3"></td>
    </tr>
    <tr> 
      <td width="6%">&nbsp;</td>
      <td width="14%">名&nbsp;&nbsp;&nbsp;&nbsp;称</td>
      <td><input name="Name" type="text" id="Name" style="width:92%" value="<%=Request("Name")%>"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>类&nbsp;&nbsp;&nbsp;&nbsp;型</td>
      <td><input name="Type" type="radio" id="TypeFL" onclick="ChoosePic();" value="0" <% if Request("Type")="0" then response.Write("checked") end if%>>
        文字 
        <input name="Type" type="radio" id="TypeFLP" onclick="ChoosePic();" value="1" <% if Request("Type")="1" or Request("Type")="" then Response.Write("checked") end if%>>
        图片</td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>显示内容</td>
      <td><input name="Content" type="text" id="Content" size="35" value="<%=Request("Content")%>"> <input id="PicChoose" type="button" name="PicChoose" value="选择图片"  onClick="OpenWindowAndSetValue('../inc/SelectPic.asp?CurrPath=/<% = UpFiles %>',550,290,window,document.FLForm.Content);"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>应用页面</td>
      <td><input name="AddressIndex" type="checkbox" id="AddressIndex" value="1" <%if Request("AddressIndex") = "1" then Response.Write("checked") end if%>>
        首页 
        <input name="AddressClass" type="checkbox" id="AddressClass" value="2" <%if Request("AddressClass") = "1" then Response.Write("checked") end if%>>
        栏目 
        <input name="AddressNews" type="checkbox" id="AddressNews" value="3" <%if Request("AddressNews") = "1" then Response.Write("checked") end if%>>
        新闻 
        <input name="AddressSpecial" type="checkbox" id="AddressSpecial" value="4" <%if Request("AddressSpecial") = "1" then Response.Write("checked") end if%>>
        专题</td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>链接地址</td>
      <td><input name="UrlT" type="text" id="Url2"  style="width:92%" value="<%if Request("UrlT")<>"" then Response.Write(Request("UrlT")) else Response.Write("http://") end if%>"></td>
    </tr>
    <tr>
      <td height="8" colspan="3"></td>
    </tr>
    <tr> 
      <td colspan="3"><div align="center"> 
          <input type="submit" name="Submit2" value=" 添 加 ">
          <input type="hidden" name="action" value="add">
          <input type="button" name="Submit3" value=" 取 消 " onClick="window.close();">
        </div></td>
    </tr>
  </table>
</form>
</body>
</html>
<script>
function ChoosePic()
{
    if (document.FLForm.TypeFL.checked==true)
	   {
		document.FLForm.PicChoose.disabled=true;
		}
	else
	   {
		document.FLForm.PicChoose.disabled=false;
		}
 }
</script>
<%
  if request.form("action") = "add" then
     Dim FLAddObj,FLAddSql,FLAddress,FLName,FLContent,FLUrl,FLAddressIndex,FLAddressClass,FLAddressNews,FLAddressSpecial
	     if request.Form("Name")<>"" then
		    FLName = Replace(replace(Request.form("Name"),"'",""),"""","")
		  else
			  response.write("<script>alert(""请填写友情链接名称"");location=""javascript:history.back(-1)"";</script>")
			  response.end
		 end if
		 if request.form("Content")<>"" then
			 FLContent = Replace(replace(Request.form("Content"),"'",""),"""","")
		 else
			  response.write("<script>alert(""请填写友情链接内容"");location=""javascript:history.back(-1)"";</script>")
			  response.end
		 end if
		 if request.form("UrlT")<> "" then
			 FLUrl = Replace(replace(Request.form("UrlT"),"'",""),"""","")
		 else
			  response.write("<script>alert(""请填写友情链接地址"");location=""javascript:history.back(-1)"";</script>")
			  response.end
		 end if
		 if Request.Form("AddressIndex")="" and Request.Form("AddressClass")="" and Request.Form("AddressNews")="" and Request.Form("AddressSpecial")="" then
			 FLAddress = 0
		  else
			 FLAddress = Cint(Request.Form("AddressIndex")&Request.Form("AddressClass")& Request.Form("AddressNews")&Request.Form("AddressSpecial"))
		  end if
		  Set FLAddObj=server.createobject("adodb.recordset")
		  FLAddSql="select * from FriendLink"
		  FLAddObj.open FLAddSql,Conn,3,3
		  FLAddObj.addnew
		  FLAddObj("Name") = Cstr(FLName)
		  FLAddObj("Content") = Cstr(FLContent)
		  FLAddObj("Url") = Cstr(FLUrl)
		  FLAddObj("Type") = Replace(replace(Request.form("Type"),"'",""),"""","")
		  FLAddObj("Address") = FLAddress
		  FLAddObj("AddTime") = Now()
		  FLAddObj.update
		  FLAddObj.Close
		  Set FLAddObj = Nothing
		response.write("<script>alert(""友情链接添加成功"");dialogArguments.location.reload();window.close();</script>")
		response.end
  end if
  Set Conn = Nothing
%>
