<!--#include file="conn.asp"-->
<!--#include file="admin/config.asp"-->
<!--#include file="admin/inc/char.asp"-->
<!--#include file="chkmember.asp"-->
<%
dim id,url,rs,sql,addr,utype,Member
id=CInt(Request.QueryString("id"))
url=CInt(Request.QueryString("url"))
utype=Request.QueryString("type")
sql="select URL,Chinese,Crack,FtpDown,Member from Software where ID="&id
set rs=conn.execute(sql)
select case utype
	case "1" addr=rs(0)
	case "2" addr=rs(1)
	case "3" addr=rs(2)
	case "4" addr=rs(3)
end select
Member=rs(4)
dim errmsg,founderr
founderr=false
if SiteSetting(8)="yes" and Member=true then
	if chkmember=false then
		founderr=true
		errmsg=errmsg+"<li>会员软件，请先登录</li>"
	else
		sql="select Point from UserInfo where USR='"&request.cookies("ydxz")("usr")&"'"
		set rs=conn.execute(sql)
		if rs(0)-DownPoint<0 then
			founderr=true
			errmsg=errmsg+"<li>您的积分不够</li>"
		else
			if request.cookies("down")(""&id&"")<>cstr(id) then
				conn.execute("update UserInfo set Point=Point-"&DownPoint&" where USR='"&request.cookies("ydxz")("usr")&"'")
			end if
			response.cookies("down")(""&id&"")=cstr(id)
		end if
	end if
end if
if founderr=false then
	conn.execute("update software set DayHits=DayHits+1,TotalHits=TotalHits+1 where ID="&id)
	if weekday(date())<>1 then
		conn.execute("update software set WeekHits=WeekHits+1 where ID="&id)
	end if
	if day(date())<>1 then
		conn.execute("update software set MonthHits=MonthHits+1 where ID="&id)
	end if
	dim gourl,i
	if utype<>"4" then
		addr=Split(addr,VBCrLf)
		gourl=Split(addr(url-1),"|")
		i=UBound(gourl)
		if i=0 then	
			response.Redirect(addr(url-1))
		else
			response.Redirect(gourl(1))
		end if
	else
		gourl=Split(addr,"|")
		sql="select FtpSetting from Config"
		set rs=conn.execute(sql)
		dim FtpSetting
		FtpSetting=Split(rs(0),VBCrLf)
		response.Redirect(FtpSetting(url-1)&gourl(1))
	end if
else
	call error()
end if
set rs=nothing
conn.close
set conn=nothing
%>