⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_date_time_configure.asp

📁 简单的asp论坛源码系统,很适用于初学者!界面简洁,功能齐全
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<% @ Language=VBScript %>
<% Option Explicit %>
<!--#include file="admin_common.asp" -->
<%
'****************************************************************************************
'**  Copyright Notice    
'**
'**  Web Wiz Forums(TM)
'**  http://www.webwizforums.com
'**                            
'**  Copyright (C)2001-2008 Web Wiz(TM). All Rights Reserved.
'**  
'**  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS UNDER LICENSE FROM 'WEB WIZ'.
'**  
'**  IF YOU DO NOT AGREE TO THE LICENSE AGREEMENT THEN 'WEB WIZ' IS UNWILLING TO LICENSE 
'**  THE SOFTWARE TO YOU, AND YOU SHOULD DESTROY ALL COPIES YOU HOLD OF 'WEB WIZ' SOFTWARE
'**  AND DERIVATIVE WORKS IMMEDIATELY.
'**  
'**  If you have not received a copy of the license with this work then a copy of the latest
'**  license contract can be found at:-
'**
'**  http://www.webwizguide.com/license
'**
'**  For more information about this software and for licensing information please contact
'**  'Web Wiz' at the address and website below:-
'**
'**  Web Wiz, Unit 10E, Dawkins Road Industrial Estate, Poole, Dorset, BH15 4JD, England
'**  http://www.webwizguide.com
'**
'**  Removal or modification of this copyright notice will violate the license contract.
'**
'****************************************************************************************



'*************************** SOFTWARE AND CODE MODIFICATIONS **************************** 
'**
'** MODIFICATION OF THE FREE EDITIONS OF THIS SOFTWARE IS A VIOLATION OF THE LICENSE  
'** AGREEMENT AND IS STRICTLY PROHIBITED
'**
'** If you wish to modify any part of this software a license must be purchased
'**
'****************************************************************************************





'Set the response buffer to true
Response.Buffer = True


'Dimension variables
Dim strMode		'holds the mode of the page, set to true if changes are to be made to the database
Dim strForumDateFormat	'Holds the date format
Dim strForumYearFormat	'Holds the year format
Dim intForumTimeFormat	'Holds the time format
Dim strDateSeporator	'Holds the date seporator between the day/month/year
Dim saryMonth(12)	'Array holding each of the months
Dim strMorningID	'Holds the identifier to show for morning in 12 hour clock
Dim strAfternoonID	'Holds the identifier to show for afternoon in 12 hour clock
Dim intMonthLoopCounter	'Loop counter for the months
Dim strForumTimeOffSet	'Time of set (+) or (-)
Dim intForumTimeOffSet	'Time off set number
Dim lngLoopCounter	'Loop counter




'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT " & strDbTable & "DateTimeFormat.* From " & strDbTable & "DateTimeFormat WHERE " & strDbTable & "DateTimeFormat.ID = 1;"

'Set the cursor type property of the record set to Dynamic so we can navigate through the record set
rsCommon.CursorType = 2

'Set the Lock Type for the records so that the record set is only locked when it is updated
rsCommon.LockType = 3

'Query the database
rsCommon.Open strSQL, adoCon

'If the user is changing the date/time setup then update the database
If Request.Form("postBack") Then

	With rsCommon
		'Update the recordset
		.Fields("Date_Format") = Request.Form("dateFormat")
		.Fields("Year_format") = Request.Form("yearFormat")
		.Fields("Time_format") = Request.Form("timeFormat")
		If Request.Form("seporator") = "space" Then .Fields("Seporator") = Chr(32) Else .Fields("Seporator") =  Request.Form("seporator")
		.Fields("am") = Request.Form("am")
		.Fields("pm") = Request.Form("pm")
		.Fields("Time_offset") = Request.Form("serverOffSet")
		.Fields("Time_offset_hours") = Cint(Request.Form("serverOffSetHours"))

		'Upadet the months (arrays start at 0 in VBScript but for simplisity we are not using location 1)
		For intMonthLoopCounter = 1 to 12
			.Fields("Month" & intMonthLoopCounter) = Request.Form("month" & intMonthLoopCounter)
		Next

		'Update the database with the new user's details
		.Update

		'Re-run the query to read in the updated recordset from the database
		.Requery
	End With
	
	
	'Empty the application level array holding the date and time format so that any changes are visable in the main forum
	Application(strAppPrefix & "saryAppDateTimeFormatData") = null
End If

'Read in the deatils from the database
If NOT rsCommon.EOF Then

	'Read in the date/time setup from the database
	'Update the recordset
	strForumDateFormat = rsCommon("Date_Format")
	strForumYearFormat = rsCommon("Year_format")
	intForumTimeFormat = CInt(rsCommon("Time_format"))
	strDateSeporator = rsCommon("Seporator")
	strMorningID = rsCommon("am")
	strAfternoonID = rsCommon("pm")
	strForumTimeOffSet = rsCommon("Time_offset")
	intForumTimeOffSet = CInt(rsCommon("Time_offset_hours"))

	'Update the months (arrays start at 0 in VBScript but for simplisity we are not using location 1)
	For intMonthLoopCounter = 1 to 12
		saryMonth(intMonthLoopCounter) = rsCommon.Fields("Month" & intMonthLoopCounter)
	Next
End If

'Include the time date function here so it's updated after any database update
%><!--#include file="functions/functions_date_time_format.asp" --><%

'Reset Server Objects
rsCommon.Close
Call closeDatabase()
%>
<!-- #include file="includes/browser_page_encoding_inc.asp" -->
<meta name="generator" content="Web Wiz Forums" />
<title>Date and Time Settings</title>

<%
'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
Response.Write("<!--//" & _
vbCrLf & "/* *******************************************************" & _
vbCrLf & "Software: Web Wiz Forums(TM) ver. " & strVersion & "" & _
vbCrLf & "Info: http://www.webwizforums.com" & _
vbCrLf & "Copyright: (C)2001-2008 Web Wiz(TM). All rights reserved" & _
vbCrLf & "******************************************************* */" & _
vbCrLf & "//-->" & vbCrLf)
'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
%>
<!-- Check the from is filled in correctly before submitting -->
<script  language="JavaScript" type="text/javascript">
function CheckForm () {

	//Intialise variables
	var errorMsg = "";
	var errorMsgLong = "";

	//Check for all the month fields having values
	for (var count = 8; count <= 20; ++count){
		if (document.frmDateTime.elements[count].value == ""){

			var monthName;

			//get the month
			if (count == 8) {monthName = "January\t";}
			else if (count == 9) {monthName = "February\t";}
			else if (count == 10) {monthName = "March\t";}
			else if (count == 11) {monthName = "April\t";}
			else if (count == 12) {monthName = "May\t";}
			else if (count == 13) {monthName = "June\t";}
			else if (count == 14) {monthName = "July\t";}
			else if (count == 15) {monthName = "August\t";}
			else if (count == 16) {monthName = "September";}
			else if (count == 17) {monthName = "October\t";}
			else if (count == 18) {monthName = "Nevember";}
			else if (count == 19) {monthName = "December";}

			//Wriet the error message
			errorMsg += "\n\t" + monthName + " \t- Enter a value for " + monthName;
		}
	}

	//If there is aproblem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "___________________________________________________________________\n\n";
		msg += "Your settings have not been updated because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -