<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="conn.asp"-->
<!--#include file="common.asp"-->
<%
dim L_SiteURL
sql="select L_SiteURL from setting"
set rs=conn.execute (sql)
if not rs.eof then
	L_SiteURL=rs("L_SiteURL")
	rs.close
end if
'µã³ö
if request("forward")<>"" and request("ID")<>"" then	
	sql="select goout,gooutToday,outToday from link where ID="&request("ID")
	rs.open sql,conn,1,3
	if not rs.eof then
		if DateDiff("d",rs("outToday"),now)=0 then
			rs("goout")=rs("goout")+1
			rs("gooutToday")=rs("gooutToday")+1
		else
			rs("goout")=rs("goout")+1
			rs("gooutToday")=1
			rs("outToday")=now
		end if
		rs.update
		rs.close
	end if
end if
'µãÈë
if request("friendid")<>"" then
	dim alternation
	dim CookiesDoMain
	dim CurrentDoMain
	
	ComeFrom=request.ServerVariables("HTTP_REFERER")
	if ComeFrom<>"" then
		sql="select * from link where username='"&(request("friendid"))&"'"
		rs.open sql,conn,1,3
		if not rs.eof then
			arr2=Split(rs("Y_MyLink"),"/")
			if CurrentDoMain=arr2(2) then
				CookiesDoMain=request.Cookies("visit")(CurrentDoMain)
				if CookiesDoMain="" then
					if DateDiff("d",rs("inToday"),now)=0 then
						rs("goin")=rs("goin")+1
						rs("goinToday")=rs("goinToday")+1
					else
						rs("goin")=rs("goin")+1
						rs("goinToday")=1
						rs("inToday")=now
					end if
					rs.update
					rs.close

					sql="select alternation from setting"
					set rs=conn.execute (sql)
					if not rs.eof then
						alternation=rs("alternation")
						rs.close
					end if
					response.cookies("visit")(CurrentDoMain)="71C570102EE77010556F615C1FC82B7F"
					Response.Cookies("visit").Expires= DateAdd("n",alternation,now()) 
				end if
			end if
		end if		
	end if
		
	'response.Redirect(L_SiteURL)
	response.write "<script>window.location.href="""&L_SiteURL&""";</script>"
end if

%>
<form name="linkforward" id="linkforward" action="" method="post" target="_self">
	<input name="forward" type="hidden">
	<input name="ID" type="hidden">
</form>
