% 'Include this file on every page on your website, EXCEPT the livesupport pages 'Checks to see if the user is wanted in a chat room by the admin and updates active users table 'You will need to change DB path and name 'Set the script timeout in seconds Server.ScriptTimeout = 90 'Set Dimension Variables Dim strDataBasePath 'Holds the path to the database Dim cString 'Holds the entire connection string Dim adoCon 'Holds the ado connection Dim SQL 'Holds SQL statement Dim strIPAddress 'Holds the current users IP address Dim rs_Active_Users 'Record sheet for the active users table Dim chatwanted 'Holds 0 if admin doesnt to chat with them, 5 if the admin does Dim usrID 'Holds user ID Set adoCon = Server.CreateObject("ADODB.Connection") '------------------------------------------------------------------------------------ 'Change this value to the path of the database strDataBasePath = "chat/LiveSupport.mdb" '------------------------------------------------------------------------------------ dim USER_AGENT, IS_IE, IS_NN USER_AGENT = Request.ServerVariables("HTTP_USER_AGENT") IS_IE = InStr(USER_AGENT,"MSIE") IS_NN = InStr(USER_AGENT,"Nav") Dim strBrowser if IS_IE then strBrowser = "IE" elseif IS_NN then strBrowser = "NS" else strBrowser = "N/A" end if 'Connection string for the database 'If the following line does not work comment it out with a ' at the start of the line and uncomment another string cString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strDataBasePath) 'Uncomment this connection string if you are using Access Database 2000 or 2002 'cString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(strDataBasePath) 'Uncomment this connection string if you are using a DSN (note: DSN is slower than the above connection strings) 'cString = "DSN=NAME_OF_DSN" 'Replace the NAME_OF_DSN with the DSN 'Give the variables some values strIPAddress = Request.ServerVariables("REMOTE_ADDR") 'Set the variable to hold the value of IP address 'Open the connection to the database path specified at top of page adoCon.Open cString 'Open the active users record sheet Set rs_Active_Users = Server.CreateObject("ADODB.Recordset") 'Create a new SQL statement to select the data from the row where users IP equals IP in database strSQL = "SELECT tblActiveUsers.* From tblActiveUsers WHERE IP='" & strIPAddress & "';" 'Set the cursor and lock types rs_Active_Users.CursorType = 2 rs_Active_Users.LockType = 3 'Open the record sheets and execute the SQL statement rs_Active_Users.Open strSQL, CString 'Check the database to see if the user whos online has a field in the database, if not create one If rs_Active_Users.EOF Then 'Insert the users IP address into a new row in database strSQL = "INSERT INTO tblActiveUsers (IP, Browser) VALUES ('" & strIPAddress & "','" & strBrowser & "');" 'Write data adoCon.Execute(strSQL) 'If there is a record for the current user then update, dont create new Else 'Set new SQL statement, set the last active field to the current time strSQL = "UPDATE tblActiveUsers SET tblActiveUsers.LastActive=Now() WHERE IP='" & strIPAddress & "';" 'Write data adoCon.Execute(strSQL) End If 'Delete records older than 10 minuites, they are no longer active strSQL = "DELETE FROM tblActiveUsers WHERE tblActiveUsers.LastActive < Now() - 0.0070;" 'Write data adoCon.Execute(strSQL) 'Requery the record sheet to get data up to date rs_Active_Users.Requery 'Close n' clean! rs_Active_Users.Close Set rs_Active_Users = Nothing adoCon.close 'Open the table tblActiveUsers set rs_Active_Users = server.createobject("ADODB.RecordSet") 'Create new SQL string StrSql="SELECT * FROM tblActiveUsers WHERE IP='" & strIPAddress & "';" 'Open record sheet execute SQL string rs_Active_Users.open StrSql,cString,3,3 'Take the values from the database field and put them in the variables chatwanted = rs_Active_Users("ChatRequest") usrID = rs_Active_Users("ID") 'Close the record sheet and clean up rs_Active_Users.Close Set rs_Active_Users = Nothing %> <% 'If the field chatwanted is set to something other than 0 Then open chat automaticaly IF chatwanted <> 0 THEN %> <%ELSE%> <%END IF%> <% Dim rsStats 'Open new connection to database adoCon.Open cString 'Create new SQL string strsql="SELECT * FROM tblStats" set rsStats=server.CreateObject("ADODB.Recordset") rsStats.open strsql,adocon,3,3 Dim intCurrNum intCurrNum = rsStats.fields("PageViews") rsStats.fields("PageViews")= intCurrNum + 1 rsStats.Update %>
|
İlgili Editör Online İse Sistem PopUp Pencerede Açılır!. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[ Admin Girişi ] [ Frekans Destek ] [ Çalışma Mantığı ve Kurulum ] |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[ ▼ Reklamlar ▼ ] |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||