www.gusucode.com > cso中国seo优化html整站源码程序 > include/fun_admin.asp
<% '函数名:isobjinstalled '作 用:检查组件是否已经安装 '参 数:strclassstring ----组件名 '返回值:true ----已经安装 ' false ----没有安装 function isobjinstalled(strclassstring) on error resume next isobjinstalled = false err = 0 dim xtestobj set xtestobj = server.createobject(strclassstring) if 0 = err then isobjinstalled = true set xtestobj = nothing err = 0 end function function classlist(typestr,sid) dim rs,sql,temp temp = "<select name=""classid"">" set rs = server.createobject("adodb.recordset") sql = "select * from so_class where typestr = '"&typestr&"' order by orderid desc" rs.open sql,conn,1,1 do while not rs.eof if sid = rs("id") then sstr = " selected" else sstr = "" end if temp = temp & "<option value="""&rs("id")&""""&sstr&">"&rs("title")&"</option>" rs.movenext loop rs.close temp = temp & "</select>" classlist = temp set rs = nothing end function function checkflag(flagstr) if request.cookies(config_cname)("flag") = "" then response.write "<script type=""text/javascript"">" response.write "alert(""非法后台登录!"");" response.write "top.location.href=""/"";</script>" else if instr(1,request.cookies(config_cname)("flag"),flagstr) = 0 then response.write "<script type=""text/javascript"">" response.write "alert(""您的权限不够!"");" response.write "top.location.href=""/manage/index.asp"";</script>" end if end if end function Function createfolder(folderpath) Dim fso,f,fldr fldr = server.mappath(folderpath) Set fso = CreateObject("Scripting.FileSystemObject") if fso.FolderExists(fldr) = false then Set f = fso.CreateFolder(fldr) else exit function end if set fso = nothing End Function Function createfile(filepath) Dim fso,f,flp flp = server.mappath(filepath) Set fso = CreateObject("Scripting.FileSystemObject") if fso.FileExists(flp) = false then Set f = fso.CreateTextFile(flp) else exit function end if set fso = nothing End Function '------------------------------------------------- '函数名称:ReadFile '作用:利用AdoDb.Stream对象来读取UTF-8格式的文本文件 '---------------------------------------------------- Function readfile(FileUrl,CharSet) Dim Str Set stm = server.CreateObject("Adodb.Stream") stm.Type = 2 '以本模式读取 stm.mode = 3 stm.charset = CharSet stm.Open stm.loadfromfile server.MapPath(FileUrl) Str = stm.readtext stm.Close Set stm = Nothing ReadFile = Str End Function '------------------------------------------------- '函数名称:write2file '作用:利用AdoDb.Stream对象来写入UTF-8格式的文本文件 '参数:FileUrl-文件相对路径;Str-文件内容;CharSet-编码格式(utf-8,gb2312.....) '---------------------------------------------------- Function write2file(FileUrl,Str,CharSet) Set stm = server.CreateObject("Adodb.Stream") stm.Type = 2 '以本模式读取 stm.mode = 3 stm.charset = CharSet stm.Open stm.WriteText Str stm.SaveToFile server.MapPath(FileUrl), 2 stm.flush stm.Close Set stm = Nothing End Function %>