人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當(dāng)前位置:蘿卜系統(tǒng)下載站 > 技術(shù)開發(fā)教程 > 詳細(xì)頁面

控制用戶登陸到網(wǎng)站與顯示在線用戶下文

控制用戶登陸到網(wǎng)站與顯示在線用戶下文

更新時(shí)間:2022-08-05 文章作者:未知 信息來源:網(wǎng)絡(luò) 閱讀次數(shù):


下面是global.asa的內(nèi)容:

Sub Application_OnStart
' Delete all saved session information, in case of a crash
set objADO = Server.CreateObject("ADODB.Connection")
sDatabasePath = Server.MapPath("/databases")
sConnection
= "filedsn="&sDatabasePath&"\readwrite.dsn;DBQ="&sDatabasePath&"\sessi
ons.mdb;"
objADO.Open(sConnection)

sUpdateCmd = "delete * from session;"
objADO.Execute(sUpdateCmd)
' Close the database down again
objADO.close
set objADO=Nothing

' Now store the DSN connection string away, so we don't have to look
it up again
Application("sessionDSN") = sConnection

End Sub

Sub Session_OnStart

' Write the session information away into the session database
set session_objADO = Server.CreateObject("ADODB.Connection")
session_objADO.Open(Application("sessionDSN"))
session_sUpdateCmd = "insert into session values
("&Session.SessionID&","
session_sUpdateCmd = session_sUpdateCmd & "'"&Request.ServerVariables
("REMOTE_ADDR")& "',"
session_sUpdateCmd = session_sUpdateCmd & "'"&Request.ServerVariables
("HTTP_USER_AGENT")&"');"
session_objADO.Execute(session_sUpdateCmd)
' Close the database down again
session_objADO.close
set session_objADO=Nothing

End Sub

Sub Session_OnEnd

' Delete the session information from the session database
set session_objADO = Server.CreateObject("ADODB.Connection")
session_sConnection = Application("sessionDSN")
session_objADO.Open(session_sConnection)
session_sUpdateCmd = "delete * from session where
SessionID="&Session.SessionID&";"
session_objADO.Execute(session_sUpdateCmd)
' Close the database down again
session_objADO.close
set session_objADO=Nothing

End Sub

下面是實(shí)現(xiàn)功能的一個(gè)例子:

<% OPTION EXPLICIT

' currentusers.asp V1.0
' Copyright 1998/99 Bann Consultants barryd@bann.co.uk
' Created 03/11/98 Modified 03/11/98
' On-line documentation at http://www.bann.co.uk/asp/
'
' COPYRIGHT NOTICE
' Copyright 1998-1999 Barry Dorrans All Rights Reserved.
'
' CurrentUsers may be used and modified free of charge by anyone so
long
' as this copyright notice and the comments above remain intact. By
using
' this code you agree to indemnify Barry Dorrans from any liability
that
' might arise from its use.
'
' Selling the code for this program without prior written consent is
' expressly forbidden. In other words, please ask first before you
try and
' make money off of my program.
'
' Obtain permission before redistributing this software over the
Internet or
' in any other medium. In all cases copyright and header must remain
intact
%>
<html>
<title>Current User report</title>
<body bgcolor="#fffaf0">

<h1> Current User Report </h1>

<br>
<table border=0>
<tr><td><p><b>Remote Host</b></td>
<td><p><b>Browser</b></td></tr>
<%

DIM objADO, sDatabasePath, sConnection, sessionRecords
DIM userCount

userCount = 0

SET objADO = Server.CreateObject("ADODB.Connection")
sDatabasePath = Server.MapPath("/databases")
sConnection
= "filedsn="&sDatabasePath&"\readonly.dsn;DBQ="&sDatabasePath&"\sessio
ns.mdb;"
objADO.Open(sConnection)

SET sessionRecords = objADO.execute("select * from session;")

DO WHILE NOT sessionRecords.EOF
userCount = userCount + 1
%>
<tr><td><p><%=sessionRecords("Host")%></td>
<td><p><%=sessionRecords("BrowserType")%></td></tr>
<% sessionRecords.MoveNext
LOOP

sessionRecords.Close
objADO.close
SET sessionRecords = Nothing
SET objADO=Nothing

%>


Session變量的有效期默認(rèn)為20分鐘,可以通過下面來改變它的默認(rèn)有效期:
Session.Timeout=(有效期的分鐘數(shù))

溫馨提示:喜歡本站的話,請(qǐng)收藏一下本站!

本類教程下載

系統(tǒng)下載排行

網(wǎng)站地圖xml | 網(wǎng)站地圖html
主站蜘蛛池模板: 德安县| 墨竹工卡县| 应用必备| 礼泉县| 行唐县| 虞城县| 永城市| 雷山县| 武川县| 建阳市| 大余县| 张家口市| 永善县| 天峻县| 柳州市| 定襄县| 莲花县| 伊通| 滕州市| 吴忠市| 开原市| 原阳县| 鄂温| 黄浦区| 齐齐哈尔市| 治县。| 平昌县| 梨树县| 台东县| 东台市| 宝山区| 阿鲁科尔沁旗| 曲沃县| 民丰县| 南开区| 疏附县| 肥城市| 黑河市| 化隆| 金川县| 新闻|