www.gusucode.com > 栽豆迷你博客 MiniBlog 3.0 正式版源码程序 > Include/CB_Admin.asp
<% Class Admin_main Public Administrator,AdminName,AdminWord Private Sub Class_Initialize() AdminName=Request.cookies(CookieName&"CaluoobAdmin")("AdminName") AdminWord=Request.cookies(CookieName&"CaluoobAdmin")("AdminWord") Administrator=False:CheckAdmin End Sub Public Sub CheckAdmin() If AdminName<>"" and AdminWord<>"" and Session(CookieName&"Admin")<>AdminWord then Administrator=true Else AdminData End If End Sub Public Sub AdminData() Dim Rs Set Rs=Caluoob.Execute("Select top 1 usernames,passwords From cb_admin Where usernames = '"&AdminName&"'") If Not(Rs.Eof and Rs.Bof) Then If AdminWord=left(Rs(1),16) then Session(CookieName&"Admin")=left(Rs(1),16) Administrator=true Else Response.Redirect "Exit.asp":Response.End End If End If Rs.close:Set Rs=Nothing End Sub '载入皮肤 Public Function loadtxt(Str) Dim ShellFile,Shelltempfile,tempfile:Set ShellFile=Server.CreateObject("Scripting.FileSystemObject") tempfile = Server.MapPath("skins/admin/"&Str) IF not(ShellFile.FileExists(tempfile)) then loadtxt="模板文件"&Str&"错误!" else Set Shelltempfile=ShellFile.opentextfile(tempfile,1,True) loadtxt=Shelltempfile.readall set Shelltempfile=nothing end if End Function Public Sub Header() Response.Write loadtxt("header.txt") End Sub Public Function Welcome() Welcome=Replace(loadtxt("welcome.txt"),"$username",AdminName) Welcome=Replace(Welcome,vbnewline,"<br>") Response.Write Welcome End Function Public Sub Footer() Dim Runtime,EndAll Runtime = FormatNumber(Timer()-Startime,6,-1) EndAll = "<div class=footer>Copyright © 2006 - 2007 "&Caluoob.DomainName&" All Rights Reserved<br>Processed in "&Runtime &"(s) "&Caluoob.SqlQueryNum &" Queries" EndAll = EndAll &" caches "&Application.Contents.Count EndAll = EndAll &" <a target=_blank href=""http://www.zaidou.com"" class=""ver"">Version 2.0</a></div></body></html>" Response.Write EndAll End Sub Public Function DelFile(FileName) SET Fs=server.CreateObject("Scripting.FileSystemObject") If FS.FileExists(server.MapPath(FileName)) then FS.DeleteFile server.MapPath(FileName),true End If Set Fs=Nothing End Function Public Function InstallSelect(Str,StrN) If Str="" then Exit Function InstallSelect="<select name="&StrN&">" If Str=0 then InstallSelect=InstallSelect&"<option value=0 selected>启用</option>" InstallSelect=InstallSelect&"<option value=1>关闭</option>" Else InstallSelect=InstallSelect&"<option value=0>启用</option>" InstallSelect=InstallSelect&"<option value=1 selected>关闭</option>" End If InstallSelect=InstallSelect&"</select>" End Function End Class %>