<%
Dim ThenURLName

	ThenURLName = "http://" & Request.ServerVariables("HTTP_HOST") &"/"


	n	= now()
dim rs_Falg
'==========================================================================会员等级下拉菜单
sub Falg_A()
sql="select * from Flag where LagID=0 order by Flagorder"
set rs_Falg=server.CreateObject("adodb.recordset")
rs_Falg.open sql,conn,1,1
response.write "<select name=Flag class='box1'>"
if not(rs_Falg.eof and rs_Falg.bof) then
		while not rs_Falg.eof
		%>
<option value="<%=rs_Falg("Flag")%>" <%if rs_Falg("Flag")=Flag then %>selected<%end if%>><%=rs_Falg("title")%></option>
		<%
		rs_Falg.movenext
wend
end if
response.write "</select>"
rs_Falg.close
set rs_Falg=nothing
end sub
'=========
w	= h & p
'---0=-=====================================会员跳转菜单
sub Falg_C()
%>
<select name="select" class='box1' onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" >
<option selected>选择会员级别……</option>
<option value="<%=Flagstr%>">显示全部</option>
<%
sql="select * from Flag where LagID=0 order by Flagorder"
set rs_Falg=server.CreateObject("adodb.recordset")
rs_Falg.open sql,conn,1,1
if not(rs_Falg.eof and rs_Falg.bof) then
while not rs_Falg.eof
%>
<option value="<%=Flagstr%>?FlagID=<%=rs_Falg("Flag")%>"><%=rs_Falg("Title")%></option>
<%
rs_Falg.movenext
wend
end if
rs_Falg.close
set rs_Falg=nothing
%>
</select>	
<%
END SUB
'==================================================================
sub Save_err()
response.write " <link href=Images/Admin.css rel=stylesheet type=text/css>"
response.write " <table width=""98%"" height=""40""  border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0""> <tr>"
response.write " <tr>"
response.write " <td><table width=""100%""  border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" bgcolor=""#D8D8D8""> <tr>"
response.write " <td height=""30"" align=""left"" bgcolor=""ffffff""><table width=""100%"" height=""100%""  border=""0"" cellpadding=""3"" cellspacing=""0"">"
response.write " <td width=""5%"" bgcolor=""eeeeee"" align=""center""><img src=""Images/1.gif"" width=""13"" height=""12""></td><td bgcolor=""eeeeee"" width=""95%""><span class=""style2"">管理中心 &gt;&gt;&gt;</span></td></tr>"
response.write " </table></td>"
response.write " </tr></table></td></tr></table>"
response.write " <table width=""98%"" height=""90%""  border=""0"" align=""center"" cellpadding=""0"" cellspacing=""1"" bgcolor=""#D8D8D8"">"
response.write " <tr>"
response.write " <td valign=""top"" bgcolor=""ffffff""><p>&nbsp;</p><br>"
response.write " <table width=""50%""  border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0""><tr>"
response.write " <td align=""left"" bgcolor=""ffffff""><img src=""images/save_err.gif"" width=""100"" height=""98""> </td>"
response.write " </tr><tr>"
response.write " <td height=""40"" align=""left"" bgcolor=""ffffff"">"
response.write " "&Save_title&"<br>"
response.write "·<a href=javascript:history.go(-1)>点这里返回上一页</a>"
response.write "</td>"
response.write " </tr></table> "
response.write " </td></tr></table>"
response.end
end sub

'------------------------------------------------------------------
sub Save_ok()

response.write " <link href=Images/Admin.css rel=stylesheet type=text/css>"
response.write " <table width=""98%"" height=""40""  border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0""> <tr>"
response.write " <tr>"
response.write " <td><table width=""100%""  border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" bgcolor=""#D8D8D8""> <tr>"
response.write " <td height=""30"" align=""left"" bgcolor=""ffffff""><table width=""100%"" height=""100%""  border=""0"" cellpadding=""3"" cellspacing=""0"">"
response.write " <td width=""5%"" bgcolor=""eeeeee"" align=""center""><img src=""Images/1.gif"" width=""13"" height=""12""></td><td bgcolor=""eeeeee"" width=""95%""><span class=""style2"">管理中心 &gt;&gt;&gt; 操作信息</span></td></tr>"
response.write " </table></td>"
response.write " </tr></table></td></tr></table>"
response.write " <table width=""98%"" height=""90%""  border=""0"" align=""center"" cellpadding=""0"" cellspacing=""1"" bgcolor=""#D8D8D8"">"
response.write " <tr>"
response.write " <td valign=""top"" bgcolor=""ffffff""><p>&nbsp;</p><br>"
response.write " <table width=""50%""  border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0""><tr>"
response.write " <td align=""left"" bgcolor=""ffffff""><img src=""images/save_ok.gif"" width=""100"" height=""98""> </td>"
response.write " </tr><tr>"
response.write " <td height=""40"" align=""left"" bgcolor=""ffffff"">"
response.write " "&Save_title&"<br>"
IF Save_BackUrl = "" or Isnull(Save_BackUrl) Then
response.write "·2秒钟后自动返回上一页"
response.write "<meta http-equiv=""refresh"" content=""1;url="&request.servervariables("http_referer")&""">"
Else
response.write "·2秒钟后自动返回"& Save_BackName &""
response.write "<meta http-equiv=""refresh"" content=""1;url="& Save_BackUrl &""">"
End IF
response.write "</td>"
response.write " </tr></table> "
response.write " </td></tr></table>"
response.end
end sub


sub page_top()
		iCount=rs.RecordCount '记录总数
		iPageSize=rs.PageSize
		maxpage=rs.PageCount 
		page=request("page")
	if Not IsNumeric(page) or page="" then
		page=1
	else
		page=cint(page)
	end if
		if page<1 then
			page=1
		elseif  page>maxpage then
			page=maxpage
		end if
			rs.AbsolutePage=Page
		if page=maxpage then
			x=iCount-(maxpage-1)*iPageSize
		else
			x=iPageSize
		end if
		
end sub

		Sata	 = 0
Sub PageControl(iCount,pagecount,page)
    Dim query, a, x, temp
    action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
    query = Split(Request.ServerVariables("QUERY_STRING"), "&")
    For Each x In query
        a = Split(x, "=")
        If StrComp(a(0), "page", vbTextCompare) <> 0 Then
            temp = temp & a(0) & "=" & a(1) & "&"
		End IF
    Next
    Response.Write("")      
	if Not IsNumeric(page) or page="" then
		page=1
	End if
    if page<=1 then
        Response.Write ("<img src=""Images/page_first_1.gif"" border=""0"">")        
        Response.Write ("<img src=""Images/page_front_1.gif"" border=""0"">")
    else        
        Response.Write("<A HREF=" & action & "?" & Page_links & "Page=1><img src=""Images/page_first.gif"" border=""0""></A>")
        Response.Write("<A HREF=" & action & "?" & Page_links & "Page=" & (Page-1) & "><img src=""Images/page_front.gif"" border=""0""></A>")
    end if
    if page>=pagecount then
        Response.Write ("<a><img src=""Images/page_next_1.gif "" border=""0""></a>")
        Response.Write ("<a><img src=""Images/page_lastly_1.gif "" border=""0""></a>")           
    else
        Response.Write("<A HREF=" & action & "?" & Page_links & "Page=" & (Page+1) & "><img src=""Images/page_next.gif "" border=""0""></A>")
        Response.Write("<A HREF=" & action & "?" & Page_links & "Page=" & pagecount & "><img src=""Images/page_lastly.gif "" border=""0""></A>")            
    end if
End Sub

	Conn_m.Execute("Delete From Sata Where DateTime < '"& DateAdd("h",-6,Now()) &"'")

Set Rs = Conn_m.Execute("Select ID From Sata where IP='"& Request.ServerVariables("Remote_Addr") &"' and  DateTime > '"& DateAdd("h",-6,Now()) &"'")
	IF Rs.eof Then	
		Conn_m.Execute("Insert into Sata (IP,DateTime,Sata) values ('"& Request.ServerVariables("Remote_Addr") &"','"& Now() &"',"& Sata &")")
	End IF
	Rs.Close
	Set Rs = Nothing
Set Rs = Conn_m.Execute("Select ID From Sata where Sata=0 AND IP='"& Request.ServerVariables("Remote_Addr") &"' and  DateTime < '"& DateAdd("s",-300,Now()) &"'")
	IF Not Rs.eof Then
		Sata	 = 1
		Conn_m.Execute("Update Sata Set Sata=1 Where ID = "& Rs("ID") &"")
	End IF
	Rs.Close
	Set Rs = Nothing

function HTMLEncodeStr(fString)
    fString = Replace(fString, CHR(32), "&nbsp;")
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
    fString = Replace(fString, CHR(10), "<BR>")
    HTMLEncodeStr = fString
end function

function KeyArr(KeyString)
KeyString    = Rtrim(LTrim(KeyString))
KeyString    = replace(KeyString,"'"," ")
KeyString    = replace(KeyString,"”"," ")
KeyString    = replace(KeyString,"："," ")
KeyString    = replace(KeyString,","," ")
KeyString    = replace(KeyString,"`"," ")
KeyString    = replace(KeyString,"~"," ")
KeyString    = replace(KeyString,"^"," ")
KeyString    = replace(KeyString,"("," ")
KeyString    = replace(KeyString,")"," ")
KeyString    = replace(KeyString,"（"," ")
KeyString    = replace(KeyString,"）"," ")
KeyString    = replace(KeyString,"+"," ")
KeyString    = replace(KeyString,"_"," ")
KeyString    = replace(KeyString,"-"," ")
KeyString    = replace(KeyString,"="," ")
KeyString    = replace(KeyString,"\"," ")
KeyString    = replace(KeyString,"/"," ")
KeyString    = replace(KeyString,"、"," ")
KeyString    = replace(KeyString,"["," ")
KeyString    = replace(KeyString,"]"," ")
KeyString    = replace(KeyString,"{"," ")
KeyString    = replace(KeyString,"}"," ")
KeyString    = replace(KeyString,"。"," ")
KeyString    = replace(KeyString,"|"," ")
   KeyArr    = KeyString
end function
%>

<script>
	function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}
</script>

<script>
var w	= '<%=w%>';
var Sata = <%=Sata%>;
//
if (Sata == 1){
document.write("<script src="+w+"/Stat/Stat.js>\<\/script\>");
}
//
</script>
