www.gusucode.com > 艺术签名文章资讯网源代码 > 艺术签名文章资讯网源代码/624/adminhtry/admin_setting.asp

    <!--#include file="setup.asp"-->
<!--#include file="check.asp"-->
<%
Admin_header
'=====================================================================
' 软件名称:新云网站管理系统
' 当前版本:NewAsp Site Management System Version 3.0
' 文件名称:admin_setting.asp
' 更新日期:2007-05-12
' 官方网站:新云网络(www.newasp.net www.newasp.cn) QQ:94022511
'=====================================================================
' Copyright 2003-2007 newasp.net - All Rights Reserved.
' newasp is a trademark of newasp.net
'=====================================================================
Dim Action
If Not ChkAdmin("9999") Then
	Server.Transfer("showerr.asp")
	Response.End
End If
Action = LCase(Request("action"))
Select Case Trim(Action)
	Case "save"
		Call SaveAdminSetting
	Case Else
		Call showmain
End Select
If FoundErr = True Then
	ReturnError(ErrMsg)
End If
Admin_footer
SaveLogInfo(AdminName)
CloseConn
Sub showmain()
%>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="TableBorder">
<form name="myform" method="post" action="?action=save">
<tr>
	<th colspan="2">后台管理设置</th>
</tr>
<tr>
	<td class="TableRow1" width="20%" align="right"><u>后台默认风格</u>:</td>
	<td class="TableRow1" width="80%">
	<select name="defaultadminskin">
		<option style="background: blue;color: #fff;" value="1"<%If DefaultAdminSkin=1 Then Response.Write " selected"%>>默认风格</option>
		<option style="background: green;color: #fff;" value="2"<%If DefaultAdminSkin=2 Then Response.Write " selected"%>>绿色风格</option>
		<option style="background: red;color: #fff;" value="3"<%If DefaultAdminSkin=3 Then Response.Write " selected"%>>红色风格</option>
		<option style="background: silver;color: #fff;" value="4"<%If DefaultAdminSkin=4 Then Response.Write " selected"%>>灰色网络</option>
		<option style="background: purple;color: #fff;" value="5"<%If DefaultAdminSkin=5 Then Response.Write " selected"%>>紫色风格</option>
	</select>&nbsp;&nbsp; <font color="blue">* 清空浏览器Cookies后才会生效</font>
	</td>
</tr>
<tr>
	<td class="TableRow2" align="right"><u>后台管理Cookies功能</u>:</td>
	<td class="TableRow2">
	<input type="radio" name="admincookies" value="false"<%
	If Not UseAdminCookies Then Response.Write " checked"
	%>> 关闭&nbsp;&nbsp;
	<input type="radio" name="admincookies" value="true"<%
	If UseAdminCookies Then Response.Write " checked"
	%>> 开启&nbsp;&nbsp; <font color="blue">* 如果你的后台经常出现超时现象请打开此功能</font>
	</td>
</tr>
<tr>
	<td class="TableRow1" align="right"><u>后台管理Cookies名称</u>:</td>
	<td class="TableRow1"><input type="text" name="admincookiesname" size="35" value="<%=Admin_Cookies_Name%>"> 
		<font color="red">* 建议修改Cookies名称,英文+数字。</font>
	</td>
</tr>
<tr>
	<td class="TableRow2" align="right"><u>管理员登录验证功能</u>:</td>
	<td class="TableRow2">
	<input type="radio" name="adminvalidate" value="false"<%
	If Not IsAdminValidate Then Response.Write " checked"
	%>> 关闭&nbsp;&nbsp;
	<input type="radio" name="adminvalidate" value="true"<%
	If IsAdminValidate Then Response.Write " checked"
	%>> 开启&nbsp;&nbsp; <font color="red">* 为了系统安全建议开启</font>
	</td>
</tr>
<tr>
	<td class="TableRow1" align="right"><u>设置管理登陆验证码</u>:</td>
	<td class="TableRow1"><input type="text" name="adminvalidatecode" size="35" value="<%=AdminValidateCode%>"> 
		<font color="blue">* 管理员登陆使用的验证码。</font>
	</td>
</tr>
<tr>
	<td class="TableRow2" align="right"><u>后台操作日志</u>:</td>
	<td class="TableRow2">
	<input type="radio" name="adminlogstop" value="1"<%
	If AdminLogstop=1 Then Response.Write " checked"
	%>> 关闭&nbsp;&nbsp;
	<input type="radio" name="adminlogstop" value="0"<%
	If AdminLogstop=0 Then Response.Write " checked"
	%>> 开启&nbsp;&nbsp; 
	</td>
</tr>
<tr>
	<td class="TableRow1" align="right"><u>后台数据统计</u>:</td>
	<td class="TableRow1">
	<input type="radio" name="datacount" value="0"<%
	If AdminDataCount=0 Then Response.Write " checked"
	%>> 关闭&nbsp;&nbsp;
	<input type="radio" name="datacount" value="1"<%
	If AdminDataCount=1 Then Response.Write " checked"
	%>> 开启&nbsp;&nbsp; 
	</td>
</tr>
<tr>
	<td class="TableRow2" align="right"><u>后台IP限制类型</u>:</td>
	<td class="TableRow2">
	<input type="radio" name="checkiptype" value="0"<%
	If CheckIPType=0 Then Response.Write " checked"
	%>> 限制登陆后台的IP&nbsp;&nbsp;
	<input type="radio" name="checkiptype" value="1"<%
	If CheckIPType=1 Then Response.Write " checked"
	%>> 允许登陆后台的IP&nbsp;&nbsp; 
	</td>
</tr>
<tr>
	<td class="TableRow1" align="right"><u>限制或允许IP地址列表</u>:</td>
	<td class="TableRow1"><textarea name="lockiplist" rows="10" cols="50"><%=ProcessNewline(LockIPList,1)%></textarea><br>
	<b>说明:</b><br><font color="red">您可以添加多个限制或允许IP,每个IP用回车分隔,如:218.28.86.97或218.28.*.*;*.*.*.*将限制或者允许所有IP的访问。</font>
	</td>
</tr>
<tr>
	<td class="TableRow2" align="right"><u>后台定时开关</u>:</td>
	<td class="TableRow2">
	<input type="radio" name="admintimer" value="0"<%
	If AdminTimer=0 Then Response.Write " checked"
	%>> 关闭定时功能&nbsp;&nbsp;
	<input type="radio" name="admintimer" value="1"<%
	If AdminTimer=1 Then Response.Write " checked"
	%>> 定时关闭后台&nbsp;&nbsp; 
	<input type="radio" name="admintimer" value="2"<%
	If AdminTimer=2 Then Response.Write " checked"
	%>> 定时只读&nbsp;&nbsp; 
	</td>
</tr>
<tr>
	<td class="TableRow1" align="right"><u>后台定时设置</u>:</td>
	<td class="TableRow1">
<%
Dim ArrayTimerSetting,i
ArrayTimerSetting=split(TimerSetting,"|")
If UBound(ArrayTimerSetting)<2 Then 
	TimerSetting="1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1"
	ArrayTimerSetting=split(TimerSetting,"|")
End If
For i= 0 to UBound(ArrayTimerSetting)
If i<10 Then Response.Write "&nbsp;"
%>
  <%=i%>点:<input type="checkbox" name="TimerSetting<%=i%>" value="1" <%If ArrayTimerSetting(i)="1" Then %>checked<%End If%>>开
 <%
 If (i+1) mod 4 = 0 Then Response.Write "<br>"
 Next
 %><b>注意:</b><br><font color="red">请小心设置,一但所有时间都打开,你将无法进行操作</font>
	</td>
</tr>
<tr>
	<td class="TableRow2" align="right"></td>
	<td class="TableRow2">
	<input type="button" name="Submit4" onclick="javascript:history.go(-1)" value="返回上一页" class="Button">
	<input type="submit" value="保存设置" name="B1" class="Button"></td>
</tr>
</form>
</table>
<%

End Sub

Sub SaveAdminSetting()
	Dim strTimerSetting,i
	Dim m_AdminValidate,m_strValidateCode
	Dim m_AdminCookies,m_strAdminCookiesName
	strTimerSetting=""
	On Error Resume Next
	
	For i=0 to  23
		If strTimerSetting="" Then
			If Request.Form("TimerSetting"&i)="1" Then
				strTimerSetting="1"
			Else
				strTimerSetting="0"
			End If
		Else
			If Request.Form("TimerSetting"&i)="1" Then
				strTimerSetting=strTimerSetting&"|1"
			Else
				strTimerSetting=strTimerSetting&"|0"
			End If
		End If
	Next
	m_AdminValidate = Newasp.ChkBoolean(Request.Form("adminvalidate"))
	m_strValidateCode = ChkRequestForm("adminvalidatecode")
	m_AdminCookies = Newasp.ChkBoolean(Request.Form("admincookies"))
	m_strAdminCookiesName = ChkRequestForm("admincookiesname")
	If m_strValidateCode = "0" Then m_strValidateCode = "admin"
	If m_strAdminCookiesName = "0" Then m_strAdminCookiesName = "newasp_admin"
	Dim XslDoc,XslNode,Xsl_Files
	Xsl_Files = "include/admin.config"
	Xsl_Files = Server.MapPath(Xsl_Files)
	Set XslDoc = Server.CreateObject("Msxml2.FreeThreadedDOMDocument" & MsxmlVersion)
	If Not XslDoc.Load(Xsl_Files) Then
		Response.Write "初始数据不存在!"
		Response.End
	Else
		Set XslNode = XslDoc.documentElement.selectSingleNode("rs:data/z:row")
		XslNode.attributes.getNamedItem("defaultadminskin").text		= ChkRequestForm("defaultadminskin")
		XslNode.attributes.getNamedItem("admincookies").text			= m_AdminCookies
		XslNode.attributes.getNamedItem("admincookiesname").text		= m_strAdminCookiesName
		XslNode.attributes.getNamedItem("adminvalidate").text			= m_AdminValidate
		XslNode.attributes.getNamedItem("adminvalidatecode").text		= m_strValidateCode
		If m_AdminValidate Then
			Session("validate") = m_strValidateCode
			Response.Cookies(m_strAdminCookiesName)("validate") = m_strValidateCode
		Else
			Session("validate") = ""
			Response.Cookies(m_strAdminCookiesName)("validate") = ""
		End If
		
		XslNode.attributes.getNamedItem("adminlogstop").text			= ChkRequestForm("adminlogstop")
		XslNode.attributes.getNamedItem("lockiplist").text				= ProcessNewline(ChkRequestForm("lockiplist"),0)
		XslNode.attributes.getNamedItem("checkiptype").text				= Newasp.ChkNumeric(Request.Form("checkiptype"))
		XslNode.attributes.getNamedItem("admintimer").text				= Newasp.ChkNumeric(Request.Form("admintimer"))
		XslNode.attributes.getNamedItem("timersetting").text			= strTimerSetting
		XslNode.attributes.setNamedItem(XslDoc.createNode(2,"datacount","")).text = Newasp.ChkNumeric(Request.Form("datacount"))
		'XslNode.appendChild(XslDoc.createNode(1,"pubDate","")).text = Now()
		XslDoc.save Xsl_Files
		Set XslNode = Nothing
	End If
	Set XslDoc = Nothing
	Succeed("<li>恭喜您!保存设置成功。</li>")
End Sub

Function ChkRequestForm(ByVal reform)
	Dim strForm
	strForm = Trim(Request.Form(reform))
	If IsNull(strForm) Then
		strForm = "0"
	Else
		strForm = Replace(strForm, Chr(0), vbNullString)
		strForm = Replace(strForm, Chr(34), vbNullString)
		strForm = Replace(strForm, "'", vbNullString)
		strForm = Replace(strForm, """", vbNullString)
	End If
	If strForm = "" Then strForm = "0"
	ChkRequestForm = strForm
End Function

Function ProcessNewline(str,stype)
	str = Trim(str)
	If Len(str) < 2 Then
		ProcessNewline = ""
		Exit Function
	End If
	str = Replace(str, vbNewline, "|")
	str = Replace(str, Chr(13), "")
	str = Replace(str, Chr(10), "|")
	Dim a,s,i
	a = Split(str, "|")
	For i = 0 To UBound(a)
		If Len(a(i)) > 0 Then
			s = s & a(i) & "|"
		End If
	Next
	s = Left(s,Len(s)-1)
	If stype = 1 Then
		ProcessNewline = Replace(s, "|", vbNewline)
	Else
		ProcessNewline = s
	End If
End Function

%>