<!--#include file="var.inc.asp"-->
<!--#include file="md5.inc.asp"-->
<!--#include file="upload.inc"-->
<%
' 常量设置
const adCmdText=1
const adCmdTable=2

' key set
const adOpenForwardOnly=0
const adOpenKeyset=1
const adOpenDynamic=2
const adOpenStatic=3

' lock type
const adLockReadOnly=1
const adLockPessimistic=2
const adLoctOptimistic=3
const adLoctBatchOptimistic=4


'Var Define
dim newsStatus,processStatus,newsAuditingStatus,adType,cityType,strMainFunction,strFunctionList,strFunctionAction,strFunctionRight,userkind
' Function List

dim zb 
zb=array("A组","B组","C组","D组","E组","F组","G组","H组","进程预测","淘汰赛")

newsStatus = array("请选择…","无效","有效","推荐")
processStatus = array("请选择…","未处理","已处理")
newsAuditingStatus = array("请选择…","未审","已审")
userKind = array("请选择…","普通用户","圈子管理员","线上活动管理")

adType = array("请选择…","首页左一(154*117)","首页左二(185*52)","首页左三(185*222)","首页中一(608*104)","首页中二(442*104)","首页中三(608*82)","喜馆(365*150)","喜馆右一(179*95)","喜馆右二(179*95)","对联广告(100*300)","浮动广告(100*100)","时尚车间一(136*87)","时尚车间二(136*87)","时尚车间三(136*87)","时尚车间四(136*87)")
cityType = array("请选择…","成都")

strMainFunction = array("新闻管理","会员管理","工具箱","系统设置")
strFunctionList = array("新闻类别管理:栏目内容管理:新闻编辑:新闻发布:新闻审核","会员管理","日记管理:图片管理:知道管理:留言管理:小喇叭:圈子管理:友情链接:竞猜管理","添加操作员:修改口令/权限:删除操作员:密码修改")
strFunctionAction = array("newsClass:newsMenu:news:newsIssue:newsAuditing","member","article:userpic:know:message:speaker:group:links:guess","userAdd:userModify:userDel:passModify")
strFunctionRight = array("A0:A1:A2:A3:A4","B0","C0:C1:C2:C3:C4:C5:C6:C7","Z0:Z1:Z2:Z3")

function ShowFunctions()
	dim i,j,k,strMyRight
	dim strSubFunctionList,strSubFunctionAction,strSubFunctionRight
	if (action = "welcome") or (action = "photos") or (action = "words") or (action = "presentUsers") then
		CanDoThisAction=true
	else
		CanDoThisAction=false
	end if
	strMyRight = split(LOGINRIGHT,",")
	for i = 0 to ubound(strMyRight)
		for j = 0 to ubound(strFunctionList)
			strSubFunctionList = split(strFunctionList(j),":")
			strSubFunctionAction = split(strFunctionAction(j),":")
			strSubFunctionRight = split(strFunctionRight(j),":")
			for k = 0 to ubound(strSubFunctionList)
				if strSubFunctionRight(k)= strMyRight(i) then	'有此权限
					if strSubFunctionAction(k) = action then
						strFunctionName = strSubFunctionList(k)
						CanDoThisAction = True
					end if
				end if
			next
		next
	next
	ShowFunctions = CanDoThisAction
end function

function isFloat(varName,minLen,maxLen)
	dim myReg
	varName = trim(varName)

	set myReg = new RegExp
	myReg.Pattern = "^[0-9]{"& minLen &","& maxLen &"}[\.]{0,1}[0-9]{0,3}$"
	myReg.IgnoreCase = False
	if myReg.Test(varName) = 0 then
		if minLen = 0 then
			varName = 0
		else
			varName = "Error"
		end if
	end if
	set myReg = nothing
	isFloat = varName
end function

function checkStr(str)
	if isnull(str) then
		checkStr = ""
		exit function 
	end if
	checkStr=replace(str,"'","''")
end function

function HTMLSpecialChars(myStr)
	HTMLSpecialChars = checkStr(Replace(Replace(Replace(Replace(myStr,"&","&amp;"),"<","&lt;"),">","&gt;"),"""","&quot;"))
end function

function ToHTMLSpecialChars(myStr)
	if isNUll(myStr) or (myStr = "") then
		ToHTMLSpecialChars = ""
		exit function 
	end if
	ToHTMLSpecialChars = Replace(Replace(Replace(Replace(myStr,"&amp;","&"),"&lt;","<"),"&gt;",">"),"&quot;","""")
end function

function DisplayMessage(strMessage, withhr)
%>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#CCE0CF" bordercolordark="#FFFFFF" align="center">
  <tr class="ListTableHeader">
    <td colspan="2" background="images/TableHeaderBg.gif" nowrap><font color="RED"><b>&nbsp;&nbsp;系统消息提示</b><font></td>
  </tr>
  <tr class="InputTableRow">
    <td width="32">&nbsp;</td>
    <td><%=strMessage%></td>
  </tr>
</table>
<%
end function

function NoLogin()
	Response.Write "<script language=""javascript"">"& vbCrLf &"alert(""参数传递错误！"");"& vbCrLf &"window.returnValue=null;"& vbCrLf &"</script>"
	Response.End
end function

'判断数字是否整形
function isInteger(para)
       on error resume next
       dim str
       dim l,i
       if isNUll(para) then 
          isInteger=false
          exit function
       end if
       str=cstr(para)
       if trim(str)="" then
          isInteger=false
          exit function
       end if
       l=len(str)
       for i=1 to l
           if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
              isInteger=false 
              exit function
           end if
       next
       isInteger=true
       if err.number<>0 then err.clear
end function

dim i,j,bFirst
dim iCurrentPage,iMaxPage,iRowsPerPage,iMaxRowCount
dim conn,cmdtemp,strCon,db,action,LOGINID,PageLoginTitle,SystemUpload,SystemUploadURL,urlParam
dim sql,rs,rsClass,rowsOfPage,totalPages
dim bNewsBase
bNewsBase = false
iRowsPerPage = 15
SystemUpload = "/upload/webimg/"
SystemUploadURL = "/upload/webimg/"

'初始化
'-----------------------------------------------------------------------------------------------
LOGINID = request("LOGINID")
action = request("action")
urlParam = "functions.asp?action="& action &"&LOGINID="& LOGINID &"&page="&trim(Request("page"))

'请填写数据库具体参数
'-----------------------------------------------------------------------------------------------
Set conn = Server.CreateObject("ADODB.Connection")
strCon="Provider=SQLOLEDB.1;Password='数据库密码';Persist Security Info=True;User ID='用户名';Initial Catalog='数据库名';Data Source='服务器地址'"

conn.Open strCon
set rs = server.createobject("adodb.recordset")
%>