⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 con_video_class.asp

📁 是个不错的文件代码,希望大家好好用,
💻 ASP
字号:
<!-- #include file="common_video.asp" -->
<%
'****************************************************
' 玫瑰情缘 2006v3.0      power by www.meigui8.cn
' email: 556248@qq.com  , 100053555@qq.com
' web: http://www.meigui8.cn
' copyright (c) 2006 meigui8.cn all rights reserved.
'****************************************************
dim video_skin
set video_skin=new class_video
video_skin.cachename=joekoe_cms.web_cookies&"_video"
video_skin.reloadtime=14400

class class_video
	public reloadtime,cachename,main_picurl,main_html
	private localcachename,cache_data,puthtml

	'默认全局变量
	private sub class_initialize()
		reloadtime=14400
		'取地址为缓存名称、cookies名
		cachename=replace(replace(replace(server.mappath("index.asp"),"index.asp",""),":",""),"\","")
	end sub
	public property let name(byval vnewvalue)
		localcachename=lcase(vnewvalue)
	end property
	public property let value(byval vnewvalue)
		if localcachename<>"" then
			redim cache_data(2)
			cache_data(0)=vnewvalue
			cache_data(1)=now()
			application.lock
			application(cachename & "_" & localcachename) = cache_data
			application.unlock
		else
			err.raise vbobjecterror + 1, "cacheserver", " please change the cachename."
		end if
	end property
	public property get value()
		if localcachename<>"" then
			cache_data=application(cachename & "_" & localcachename)
			if isarray(cache_data) then
				value=cache_data(0)
			else
				err.raise vbobjecterror + 1, "cacheserver", " the cache_data("&localcachename&") is empty."
			end if
		else
			err.raise vbobjecterror + 1, "cacheserver", " please change the cachename."
		end if
	end property
	'------------缓存操作-------------
	'判断缓存是否存在、过期
	public function cache_chk()
		cache_chk=true
		cache_data=application(cachename & "_" & localcachename)
		if not isarray(cache_data) then exit function
		if not isdate(cache_data(1)) then exit function
		if datediff("s",cdate(cache_data(1)),now()) < (60*reloadtime) then cache_chk=false
	end function
	'写缓存
	public sub cache_set(mycahename,cahestr)
		application.lock
		application(cachename&"_"&mycahename)=cahestr
		application.unlock
	end sub
	'取缓存
	public function cache_get(mycahename)
		cache_get=application(cachename&"_"&mycahename)
	end function
	'删除缓存
	public sub cache_del(mycahename)
		application.lock
		application.contents.remove(cachename&"_"&mycahename)
		application.unlock
	end sub
	public sub video_skin_del()
	  cache_del("picurl")
	  cache_del("style")
	  cache_del("nsort")
	  cache_del("scroll")
	  cache_del("counter")
	end sub
	'-----------取统计数据---------
	public sub countertocache()
		sql="select count(id) from [video]"
		set rs=joekoe_cms.exec(sql,1)
		if not rs.eof then value=rs(0)
		rs.close
	end sub
	'-----------取分类数据---------
	public sub nsorttocache()
		sql="select c_id,c_name from jk_class where nsort='video' order by c_order,c_id"
		set rs=joekoe_cms.exec(sql,1)
		if not rs.eof then value=rs.getrows()
		rs.close
  	end sub
	'-----------取滚动图片数据---------
	public sub scrolltocache(snum)
		dim tmpstr
		pic_w=96
		pic_h=72
		sql="select top "&snum&" id,name,pic from video where pic<>'' order by id desc"
		call joekoe_cms.exec(sql,-1)
		rs.open sql,conn,1,3
		do while not rs.eof
			tmpstr=tmpstr&vbcrlf&"    <td><a href='video_view.asp?id="&rs(0)&"' title='影片名称:"&joekoe_cms.code_html(rs(1),1,0)&"' target=_blank>"&pic_url(rs(2),1)&"</a></td>"
			rs.movenext
		loop
		rs.close
		value=tmpstr
  	end sub
	'-----------取模板数据---------
	private sub modtocache(mod_fields)
		sql="select top 1 "&mod_fields&" from video_style where isdef=1"
		set rs=joekoe_cms.exec(sql,1)
		if not rs.eof then value=rs(0)
		rs.close
	end sub
	'-----------取全局模板-----------
	public sub mod_load()
		dim main_style
		name="picurl"
		if cache_chk() then modtocache ("picurl")
		main_picurl=value
		name="style"
		if cache_chk() then modtocache ("style")
		main_style=split(value,"@@@")
		main_html=split(main_style(0),"|||")
	end sub

	'----模板操作,打印页面 或 赋值
	public sub htmlnums(mnum)
		puthtml=main_html(mnum)
	end sub
	public sub htmlrcod(mod_str,view_str)
		puthtml=replace(puthtml,"{$"&mod_str&"}",view_str)
	end sub
	public sub htmlview(knum)
		puthtml=replace(puthtml,"{$picurl}",main_picurl)
		response.write vbcrlf&puthtml
		if knum=1 then response.write vbcrlf & ukong
	end sub
	public function htmlgets(knum)
		puthtml=replace(puthtml,"{$picurl}",main_picurl)
		htmlgets=vbcrlf&puthtml
		if knum=1 then htmlgets=htmlgets & vbcrlf & ukong
	end function
	'-------常规操作----------
	public function code_str(strers)
    	dim strer
    	strer=strers
    	if strers="" then
    		code_str=""
    		exit function
    	end if
		strer=replace(strer,"'","''")
		code_str = strer
	end function

	public function video_free()
		video_free=1
		if isfree then exit function
		if buy_true then exit function
		if free_ip then exit function
		if free_mode then exit function
		if free_username then exit function
		video_free=0
	end function

	public function chk_user_power(ps,vs)
		if ps<>"" and instr("."&ps&".","."&login_modep&".")<1 then
			call video_error("nopower")
		end if
	end function

	public function free_ip()
		dim ipdim,ipnum
		free_ip=0
		if web_dim(42)="" and isnull(web_dim(42)) then exit function
		ipdim=split(web_dim(42),"|")
		ipnum=ubound(ipdim)
		for i=0 to ipnum
			if instr(user_ip,ipdim(i))<>0 then
				free_ip=1
				erase ipdim
				exit function
			end if
		next
		erase ipdim
	end function

	public function free_username()
		free_username=0
		if login_username="" and login_mode="" then exit function
		if web_dim(43)<>"" and not isnull(web_dim(43)) then
			if instr("|"&web_dim(43)&"|","|"&login_username&"|")<>0 then free_username=1
		end if
	end function

	public function free_mode()
		free_mode=0
		if web_dim(40)<>"" and not isnull(web_dim(40)) then
			if instr("."&web_dim(40)&".","."&login_modep&".")<>0 then free_mode=1
		end if
	end function

	public function buy_true()
		dim buytim,buytype
		sql="select top 1 tim,freetype from video_free where username='"&login_username&"' or userip='"&user_ip&"'"
		set rs=joekoe_cms.exec(sql,1)
		if rs.eof then
			rs.close
			buy_true=0
			exit function
		end if
		buytype=int(rs("freetype"))
		buytim=rs("tim")
		rs.close
		if fc_tim(buytim,buytype) then
			call joekoe_cms.exec("delete from video_free where username='"&login_username&"' or userip='"&user_ip&"'",0)
			response.write joekoe_cms.js_put("alert(""提示:\n\n您的 "&buy_types(buytype)&" 已经到期!请注意重新购买!"");",1)
			buy_true=0
			exit function
		end if
		buy_true=1
	end function

	public function buy_money(bt)
		dim tmpmoney
		select case bt
		case 1
			tmpmoney=int(web_dim(36))
		case 2
			tmpmoney=int(web_dim(37))
		case else
			tmpmoney=int(web_dim(38))
		end select
		buy_money=int(tmpmoney)
	end function

	public function buy_types(bt)
		select case bt
		case 1
			buy_types="月卡"
		case 2
			buy_types="季卡"
		case else
			buy_types="年卡"
		end select
	end function

	public function fc_tim(btim,bt)
		dim tim_dim,tmptim
		fc_tim=0
		select case bt
		case 1
			tmptim=dateadd("m",1,btim)
		case 2
			tmptim=dateadd("m",3,btim)
		case else
			tmptim=dateadd("yyyy",1,btim)
		end select
		tim_dim=datediff("s",tmptim,joekoe_cms.now_time)
		if int(tim_dim)>=0 then fc_tim=1
	end function

	public function last_tim(btim,bt)
		select case bt
		case 1
			last_tim=dateadd("m",1,btim)
		case 2
			last_tim=dateadd("m",3,btim)
		case else
			last_tim=dateadd("yyyy",1,btim)
		end select
	end function

	public function video_server(snum,vtype,vurl)
		dim v_dim,v_num,vserver,dnum
		if left(vurl,1)="/" then vurl=right(vurl,len(vurl)-1)
		if snum=0 then
			video_server=vurl
			exit function
		end if
		v_dim=split(web_dim(41),"$")
		v_num=ubound(v_dim)
		dnum=int(snum-1)
		if dnum>v_num then
			erase v_dim
			call video_error("错误的视频服务器地址!")
			exit function
		end if
		vserver=v_dim(dnum)
		erase v_dim
		v_dim=split(vserver,"|")
		if ubound(v_dim)<>2 then
			erase v_dim
			video_server=""
			exit function
		end if
		video_server=v_dim(vtype)
		erase v_dim
		if right(video_server,1)<>"/" then video_server=video_server&"/"
		if left(video_server,1)="/" then video_server=right(video_server,len(video_server)-1)
		video_server=video_server&vurl
	end function

	public function video_selsv(sels)
		dim tmp1
		tmp1="<option value=0>非本地服务器</option>"
		dim servername
		servername=split(web_dim(41),"$")
		for i=1 to ubound(servername)+1
			tmp1=tmp1&"<option value='"&i&"'"
			if sels=i then tmp1=tmp1&" selected"
			tmp1=tmp1&">"&split(servername(i-1),"|")(2)&"</option>"
		next
		erase servername
		video_selsv=tmp1
	end function

	public function sel_type(seled,selstr)
		dim snum,sdim,temp1
		if selstr="" then exit function
		if instr(selstr,"|")<0 then
			sel_type="<option value='"&selstr&"'>"&selstr&"</option>"
			exit function
		end if
		sdim=split(selstr,"|")
		snum=ubound(sdim)
		for i=0 to snum
		  temp1=temp1&"<option value='"&sdim(i)&"'"
		  if (seled=sdim(i)) then temp1=temp1&" selected"
		  temp1=temp1&">"&sdim(i)&"</option>"
		next
		erase sdim
		sel_type=temp1
	end function
end class
'****************************************************
' 玫瑰情缘 2006v3.0      power by www.meigui8.cn
' email: 556248@qq.com  , 100053555@qq.com
' web: http://www.meigui8.cn
' copyright (c) 2006 meigui8.cn all rights reserved.
'****************************************************
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -