<!--#include file="../../fy_inc/fy.User.asp"-->
<%
	ConnectionDatabase
		echo "<html>"
		echo "<head>"
		echo "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
		echo "<title>保存申请友情链接</title>"
		echo "</head>"
		Dim LinkID, ClassLinkID, SiteName, Webadmin, Email,   Locked, Url, LinkType, Logo, Hits, Rec, Descript, TrueIP,Code
		Dim TempObj, LinkRS, LinkSql
		LinkID = Rsql(Replace(Replace(Request.Form("LinkID"), """", ""), "'", ""))
		SiteName = Rsql(Request.Form("SiteName"))
		Webadmin = Rsql(Request.Form("Webadmin"))
		Email = Rsql(Request.Form("Email"))
		ClassLinkID = Replace(Replace(Request.Form("ClassLinkID"), """", ""), "'", "")
		Code=fycms.S("Code")
		Locked = 0
		Url = Replace(Replace(Request.Form("Url"), """", ""), "'", "")
		LinkType = Replace(Replace(Request.Form("LinkType"), """", ""), "'", "")
		Logo = Replace(Replace(Request.Form("Logo"), """", ""), "'", "")
		Hits = 0
		Rec = 0
		Descript = Rsql(Request.Form("Description"))
		IF Trim(Request.Form("Code"))<>Trim(Session("GetCode")) then 
			Call Alert("验证码有误，请重新输入!", "")
			Response.End		
		end If
		IF ClassLinkID="" then 
			Call Alert("所属类别为空", "")
			Response.End		
		end if
		If SiteName <> "" Then
				If Len(SiteName) >= 200 Then
					Call Alert("网站名称不能超过100个字符!", "")
					
					 Response.End
				End If
		 Else
				Call Alert("请输入网站名称!", "")
				 Response.End
		 End If
				Set TempObj = Conn.Execute("Select SiteName from [Link_fy] where SiteName='" & SiteName & "'")
				If Not TempObj.EOF Then
					Call Alert("数据库中已存在该友情链接的站点名称!", "LinkAdd.asp")
					Response.End
				End If
			  Set LinkRS = Server.CreateObject("adodb.recordset")
			  LinkSql = "select * from [Link_fy] Where (ID IS NULL)"
			  LinkRS.Open LinkSql, Conn, 1, 3
			  LinkRS.AddNew
			  LinkRS("SiteName") = SiteName
			  LinkRS("Webadmin") = Webadmin
			  LinkRS("Email") = Email
			  LinkRS("ClassLinkID") = ClassLinkID
			  LinkRS("Locked") = Locked
			  LinkRS("Url") = Url
			  LinkRS("LinkType") = LinkType
			  LinkRS("Logo") = Logo
			  LinkRS("Rec") = Rec
			  LinkRS("Description") = Descript
			  LinkRS("AddDate") = Now
			  LinkRS("sh") = 0
			  LinkRS.Update
			  LinkRS.Close
			  Set LinkRS = Nothing
			  echo ("<script> alert('您的申请已成功提交,请等待网站管理员的审核!'); location.href='Index.asp';</script>")
%> 
