
<% 
 '===========================================================================================
	'软件名称：126 cms 视频影视管理系统
	'程序版权：126电影               '咨询QQ：479025
	'开发作者：magicblack(479025)    '官方网站：http://www.126oo.com/
	'Copyright (C) 2009 - ... 126oo.com  All Rights Reserved.
	'郑重声明:
	'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
	'    2、任何个人或组织不得以盈利为目的发布,修改,本软件及其他副本上一切关于版权的信息；
	'    3、126电影保留此软件的法律追究权利；
'==========================================================================================
%>

<%
response.Charset="GBK"

Function getXmlHttpVer()
	dim i,xmlHttpVersions,xmlHttpVersion
	getXmlHttpVer = false
	xmlHttpVersions = Array("Microsoft.XMLHTTP", "MSXML2.XMLHTTP", "MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.5.0")
	for i = 0 to ubound(xmlHttpVersions)
		xmlHttpVersion = xmlHttpVersions(i)
		if FSOOBJ.IsObjInstalled(xmlHttpVersion) then getXmlHttpVer = xmlHttpVersion : Exit Function
	next
End Function

Function GetPage(Byval url,Byval Cset)
	dim xmlHttpObj
	on error resume next
	
	set xmlHttpObj = server.CreateObject(getXmlHttpVer())
	xmlHttpObj.open "GET",url,False 
	xmlHttpObj.send
	If xmlHttpObj.Readystate<>4 then
		xmlHttpObj.close
		Set xmlHttpObj=Nothing 
		GetPage=False
		Exit function
	end if
	
	GetPage = bytesToBSTR(xmlHttpObj.responseBody,Cset) 
	set xmlHttpObj=nothing
	If Err Then errid=err.number:errdes=err.description:Err.Clear : errmsg "错误信息",errid
End Function

Function BytesToBstr(Body,Cset)
Dim Objstream
Set Objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText 
objstream.Close
set objstream = nothing
End Function

Function GetsSlectByUrl(tables,tablesname,tableid,tablesort)
	dim rs
    Response.Write"<select onchange=javascript:window.location.href=this.options[this.selectedIndex].value>"
    Response.Write"<option value=""admin_movie.asp"">全部影片</option>"
	set rs= Database.GetRecordBySQL("SELECT * FROM "&tables&" Order by "&tablesort&" asc")
	do while not rs.eof
		if Trim(Request(tables))<>"" then
			if rs(tableid) = cint(Trim(Request(tables))) then
				Response.Write"<option value=admin_movie.asp?"&tables&"="&rs(tableid)&" selected>"&rs(tablesname)&"</option>" 	
			else
				Response.Write"<option value=admin_movie.asp?"&tables&"="&rs(tableid)&">"&rs(tablesname)&"</option>" 	
			end if
		else
			Response.Write"<option value=admin_movie.asp?"&tables&"="&rs(tableid)&">"&rs(tablesname)&"</option>" 
		end if
    rs.movenext
	loop
	Database.C(rs)
    Response.Write"</select>"
End Function

Function GetDicText(tables,tablesname,tablesid,id)
on error resume next
	dim Rs
	set Rs= Database.GetRecordBySQL("SELECT "&tablesname&" FROM "&tables&" where "&tablesid&"="&id)
	if not Rs.eof then
	GetDicText=rs(tablesname)
	end if
	Database.C(rs)
End Function

Function Getshowselect(tables,tablesname,selectname,selecttitle,selectid,tablesid,tablessort)
	dim Rs,selectStr
	selectStr = ""
	
	selectStr = "<select id="""&selectname&""" name="""&selectname&""" dataType=""Require"" msg="""&selecttitle&""">"
	
    selectStr = selectStr & "<option value=""0"">"&selecttitle&"</option>"
	
	set Rs= Database.GetRecordBySQL("SELECT " & tablesid & "," &tablesname&" FROM "&tables&" Order by " & tablessort &" asc " )

	do while not Rs.eof
		if selectid<>"" then
			if Rs(tablesid)=cint(selectid) then
				selectStr = selectStr & "<option value="&Rs(tablesid)&" selected>"&Rs(tablesname)&"</option>" 	
			else
				selectStr = selectStr & "<option value="&Rs(tablesid)&">"&Rs(tablesname)&"</option>" 	
			end if
		else
			selectStr = selectStr &  "<option value="&Rs(tablesid)&">"&Rs(tablesname)&"</option>" 
		end if
    Rs.movenext
	loop
	Database.C(rs)
	selectStr = selectStr & "</select>"
    Getshowselect = selectStr
	
End Function

function getSavePicPath()
	dim datetime
	datetime = now()
	if app_picpath = 1 then
		getSavePicPath = year(datetime)&"-"&month(datetime)
	elseif app_picpath = 2 then
		getSavePicPath = year(datetime)&"-"&month(datetime)&"-"&day(datetime)
	else
		getSavePicPath = ""
	end if

end Function
%>