<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

'//* 检测用户浏览权限 *//
Function chk_power(power,ChannelIDs)
	Dim Channelpower
	If int(format_mid_num(5))=1 Then	'全站登陆浏览
		chk_power=true
		ChannelIDs=ChannelIDs
		sql="select top 1 Channelpower from AsaiMHChannel where ChannelIDs="&ChannelIDs 
		set rs=Cls.exec(sql,1) 
		if not rs.eof then 
			Channelpower=rs("Channelpower") 
			rs.close
		end if 
		if Cls.Is_Null(power)<>"" then
			if instr("."&power&".","."&login_modep&".")=0 then
				chk_power=false
				exit function
			End If
		else
			if instr("."&Channelpower&".","."&login_modep&".")=0 then
				chk_power=false
				exit function
			End If
		End If
	else
		chk_power=true
		exit function
	End If
End function

'//* 检测用户组免发布权限 *//
Function chk_putpower(ChannelIDs)
	Dim PutFreeExempts
	chk_putpower=true
	ChannelIDs=ChannelIDs
	sql="select top 1 PutFreeExempts from AsaiMHChannel where ChannelIDs="&ChannelIDs 
	set rs=Cls.exec(sql,1) 
	if not rs.eof then 
		PutFreeExempts=rs("PutFreeExempts") 
		rs.close 
	else 
		chk_putpower=false
		exit function 
	end if
	if instr("."&PutFreeExempts&".","."&login_modep&".")=0 then
		chk_putpower=false
		exit function
	End If
End function

'//* 检测用户货币不够参数 *//
Function emoney_notes(emoney,n_sort,iid,err_type,url)
	dim temp1
	emoney_notes=true
	temp1=chk_emoney(emoney,n_sort,iid)
	if temp1=true then exit function
	emoney_notes=false
	if err_type=1 then
		Call Cls.Out_Msg("您没有足够的权限或钱币进行刚才的操作！\n\n点击返回……",url)
		call web_clear(1)
	End If
End Function

'//* 检测用户货币及消费检测 *//
function chk_emoney(emoney,n_sort,iid,ChannelIDs)
	dim nrs,FreeUserGroup
	chk_emoney=true
	ChannelIDs=ChannelIDs
	sql="select top 1 FreeUserGroup from AsaiMHChannel where ChannelIDs="&ChannelIDs 
	set rs=Cls.exec(sql,1) 
	if not rs.eof then 
		FreeUserGroup=rs("FreeUserGroup") 
		rs.close 
	else 
		rs.close 
	end if 
	if int(emoney)<=0 or login_modep=1 or login_modep=2 then exit function
	if login_mode="" then
		chk_emoney=false
		exit function
	End If
	sql="select count(id) from AsaiMHnotes where username='"&login_username&"' and nsort='"&n_sort&"' and iid="&iid
	set nrs=Cls.exec(sql,1)
	if int(nrs(0))>0 then
		nrs.close
		set nrs=nothing
		exit function
	End If
	nrs.close
	set nrs=nothing
	if int(login_emoney)<int(emoney) then
		chk_emoney=false
		exit function
	End If
	If trim(request.QueryString("pay"))="yes" then
		call Cls.exec("insert into AsaiMHnotes(username,nsort,iid,emoney,tim) values('"&login_username&"','"&n_sort&"',"&iid&","&emoney&",'"&Cls.now_time&"')",0)
		call Cls.exec("update AsaiMHuserdata set emoney=emoney-"&emoney&" where username='"&login_username&"'",0)
  login_emoney=login_emoney-emoney
		exit function
	end if
	chk_emoney=false
End Function
%>
