<!--#include file="../inc/conn.asp"-->
<%
sdcms_adminid=request.Cookies(sdcms_cookies&"sdcms_id")
sdcms_adminname=request.Cookies(sdcms_cookies&"sdcms_name")
sdcms_adminpwd=request.Cookies(sdcms_cookies&"sdcms_pwd")
sdcms_all_lever=request.Cookies(sdcms_cookies&"sdcms_all_lever")
sdcms_adminip=request.Cookies(sdcms_cookies&"sdcms_ip")
Class Sdcms_Admin
	
	Public Sub Check_admin
		if sdcms_adminname="" and sdcms_adminpwd=""   then
			response.Redirect("index.asp"):Died
		else
			sql="select * from sd_admin where sdcms_name='"&sdcms_adminname&"' and sdcms_pwd='"&sdcms_adminpwd&"'  "
			set rs=conn.execute(sql)
			if rs.eof then
				response.redirect("index.asp?action=out"):Died
			end if
		end if
	End sub
	
	Public Sub Check_lever(t0)
	 
	    session(sdcms_cookies&"sdcms_admin")=conn.execute("select isadmin from sd_admin where sdcms_name='"&sdcms_adminname&"' and sdcms_pwd='"&sdcms_adminpwd&"'")(0)
		session(sdcms_cookies&"sdcms_infolever")=conn.execute("select infolever from sd_admin where sdcms_name='"&sdcms_adminname&"' and sdcms_pwd='"&sdcms_adminpwd&"'")(0)
		if session(sdcms_cookies&"sdcms_admin")=0 then
			t1=sdcms_all_lever
			if t0<>"" then
				if instr(", "&t1&", ",", "&t0&", ")=0 then echo "您没有此栏目的管理权限":Died
			end if
		end if
	End Sub
	
	Function check_info_lever
	get_classid=""
	alllever=session(sdcms_cookies&"sdcms_infolever")
	'先将栏目的id读出来，并且将相关栏目的classid也写出来
	if instr(alllever,", ")>0 then
	alllevers=split(alllever,", ")
	for i=0 to ubound(alllevers)
	get_classid=get_classid&conn.execute("select allclassid from sd_class where id="&alllevers(i)&"")(0)&","
	next
	if right(get_classid,1)="," then
	get_classid=left(get_classid,len(get_classid)-1)
	end if
	check_info_lever=get_classid
	else
	check_info_lever=conn.execute("select allclassid from sd_class where id="&alllever&"")(0)
	end if
	check_info_lever="classid in ("&check_info_lever&") "
	End Function
End Class
 
function w_check(txt,t)
	if txt="" then
		exit function
	else
		if txt=t then
			w_check="checked"
		end if
	end if
end function

function w_select(txt,t)
	if txt="" then
		exit function
	else
		if txt=t then
			w_select="selected"
		end if
	end if
end function

Function dir_check(t0)
	t0=replace(t0,"\","")
	t0=replace(t0,"/","")
	t0=replace(t0,".","")
	t0=replace(t0,",","")
	t0=replace(t0," ","_")
	dir_check=t0
End Function

Sub admin_upfile(t0,t1,t2,t3)
echo "<iframe src=""sdcms_up.asp?go="&t0&"&t="&t3&""" scrolling=""no"" frameborder=""0"" width="""&t1&""" height="""&t2&""" ></iframe>"
End sub

sub sdcms_head
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>网站信息管理系统</title>
<link href="images/sdcms.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="images/sdcms.js"></script>
</head>
<body>
<%end sub%>