<!--#include file="sd_mdb.asp"-->
<!--#include file="sd_checkuser.asp"-->
<%
webid=request.form("id")
top_day=request.form("top_day")
sql="select * from sd_user where sd_userid="&session("sd_userid")&""
rs.open sql,conn,1,3 
if not (rs.eof and rs.bof) then
	sd_Points=rs("sd_Points")
	if sd_Points>cint(top_day)*20 then
		set rs1=server.CreateObject("adodb.recordset")
		sql1="select * from sd_web where sd_id="&webid&""
		rs1.open sql1,conn,1,3
		if not (rs1.eof and rs1.bof) then
			if DateDiff("d",now(),CDate(rs1("sd_TopEndTime")))<0 then
				rs1("sd_TopEndTime")=DateAdd("d",cint(top_day),NOW())
			else
				rs1("sd_TopEndTime")=DateAdd("d",cint(top_day),CDate(rs1("sd_TopEndTime")))
			end if
			rs1.update
			rs1.close
			set rs1=nothing
		else
			rs1.close
			set rs1=nothing
			Response.Write ("<script language=javascript>alert('没有找到相关ID记录！');this.location.href='sd_user_main.asp';</script>")
			response.end
		end if
		rs("sd_Points")=rs("sd_Points")-cint(top_day)*20
		session("sd_Points")=rs("sd_Points")
		rs.update
		rs.close
		set rs=nothing
		Response.Write ("<script language=javascript>alert('友情链接置顶成功！');this.location.href='sd_user_main.asp';</script>")
		response.end
	ELSE
		rs.close
		set rs=nothing
		Response.Write ("<script language=javascript>alert('你的金币不够！不能友情链接置顶！');this.location.href='sd_user_main.asp';</script>")
		response.end
	END IF
END IF
%>