好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > 用ASP+DLL實現WEB方式修改服務器時間

用ASP+DLL實現WEB方式修改服務器時間

熱門標簽:怎么在地圖標注自己 外呼系統API接口 縣域地圖標注打印店 鳳臺百度地圖標注店 萊西電子地圖標注 個人可以辦理400電話么 金昌電話機器人價格 武夷山旅游地圖標注 修改地圖標注
昨天一個朋友有個需求,是要通過WEB方式,修改IIS服務器上的時間,由于他的系統是ASP 3.0下開發的,所以本例子的代碼是ASP的,不是ASP.NET,但是本人寫這個文章是想拋磚引玉,畢竟編寫程序關鍵的不是語言,更重要的是一種思想,把程序語言理解為一種工具,把編程思想理解為解決問題的思路和方法,那么編寫出來的程序就是:利用“工具”按照解決問題的“思想”去解決一個問題。

首先,要感謝網友“小虎”,我是在網上看了他寫的一篇關于用VB 6.0編寫DLL組件FOR ASP的文章改寫的,他的DLL代碼只實現了改寫小時和分鐘,我增加了年、月、日、秒的修改。

首先,在VB 6.0中建立一個ActiveX Dll工程項目,信息如下:

工程名稱:systimeset
類模塊名稱:timeset

VB 6.0的類模塊代碼如下:
復制代碼 代碼如下:

Option Explicit
Private SystemTime As SystemTime
Private Declare Function SetSystemTime()Function SetSystemTime Lib "kernel32" (lpSystemTime As SystemTime) As Long
Private Type SystemTime
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
End Type

Dim tmp

Private m_Hour As Integer
Private m_Minute As Integer
Private m_Year As Integer
Private m_Month As Integer
Private m_Day As Integer
Private m_Second As Integer

'由李錫遠修改     修改日期:2006-08-31     修改項目:增加對年、月、日、秒的操作
'--------------------
'年
Public Property Get()Property Get Year() As Integer
Year = m_Year
End Property
Public Property Let()Property Let Year(tmp_Year As Integer)
m_Year = tmp_Year
End Property
'--------------------
'月
Public Property Get()Property Get Month() As Integer
Month = m_Month
End Property
Public Property Let()Property Let Month(tmp_Month As Integer)
m_Month = tmp_Month
End Property
'--------------------
'日
Public Property Get()Property Get Day() As Integer
Day = m_Day
End Property
Public Property Let()Property Let Day(tmp_Day As Integer)
m_Day = tmp_Day
End Property
'--------------------
'秒
Public Property Get()Property Get Second() As Integer
Second = m_Second
End Property
Public Property Let()Property Let Second(tmp_Second As Integer)
m_Second = tmp_Second
End Property



Public Property Get()Property Get Hour() As Integer
Hour = m_Hour
End Property
Public Property Let()Property Let Hour(tmp_Hour As Integer)
m_Hour = tmp_Hour
End Property
Public Property Get()Property Get Minute() As Integer
Minute = m_Minute
End Property
Public Property Let()Property Let Minute(tmp_Minute As Integer)
m_Minute = tmp_Minute
End Property

Public Function setup()Function setup() As Integer
SystemTime.wDay = Day
'SystemTime.wDayOfWeek = 1
SystemTime.wMilliseconds = 0
SystemTime.wMonth = Month
SystemTime.wSecond = Second
SystemTime.wYear = Year
SystemTime.wHour = Hour
SystemTime.wMinute = Minute
setup = SetSystemTime(SystemTime)
End Function

將其編譯為systimeset.dll的文件。

關于DLL的注冊,通常VB在本機上編譯后,會自動將DLL注冊;但如果你要放到IIS服務器上,請使用如下方法:
1、將systimeset.dll拷貝到c:\WINDOWS\system32下;
2、在開始菜單的運行里面輸入:regsvr32 systimeset.dll     (敲回車啊)
3、因為修改服務器的時間,INTERNET來賓帳戶不具有該權限,設立權限請打開控制面版中的“管理工具”,然后打開“本地安全策略”--“用戶權力指派”,雙擊“更改系統時間”,在彈出的對話框中點“添加用戶或組”,將INETNET來賓帳戶加入進來。
4、一切完畢后,將IIS服務重新啟動一次。


在上面的設置完畢后,使用systimeset.dll組件的ASP代碼頁面如下:

復制代碼 代碼如下:

% @language="vbscript" %>
%
function SetTime(strYear,strMonth,strDay)
response.Expires=0
set obj=server.createobject("systimeset.timeset")
    obj.Year=strYear
   obj.Month=strMonth
    obj.Day=strDay
   if Hour(now())-8>0 then
    obj.Hour=Hour(now())-8
    else
    obj.Hour=8
    end if
    obj.Minute=Minute(now())
    obj.Second=Second(now())
    obj.setup

set obj=Nothing
end function

if request("act")="modi" then
    call SetTime(request.Form("strYear"),request.Form("strMonth"),request.Form

("strDay"))
end if
%>
form id="form1" name="form1" method="post" action="?act=modi">
  table width="290" border="0">
    tr>
      td width="77">input name="strYear" type="text" id="strYear" value="%=Year(now())%>" size="8" />/td>
     td width="49">input name="strMonth" type="text" id="strMonth" value="%=Month(now())%>" size="5" />/td>
     td width="48">input name="strDay" type="text" id="strDay" value="%=Day(now())%>" size="5" />/td>
     td width="98">input type="submit" name="Submit" value="修改日期" />/td>
   /tr>
 /table>
/form>

以上是所有實現的代碼,有問題可以加我QQ:17020415

將上面的ASP代碼頁面粘貼到一個空的ASP文件中,然后在IIS中將站點設置好就可以了。(設置IIS虛擬目錄也可以的。)


標簽:通遼 南京 邢臺 涼山 清遠 赤峰 楚雄 上海

巨人網絡通訊聲明:本文標題《用ASP+DLL實現WEB方式修改服務器時間》,本文關鍵詞  用,ASP+DLL,實現,WEB,方式,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《用ASP+DLL實現WEB方式修改服務器時間》相關的同類信息!
  • 本頁收集關于用ASP+DLL實現WEB方式修改服務器時間的相關信息資訊供網民參考!
  • 推薦文章