Apache Server for Windows Little Black Book:Tracking Your Server's Activity
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Apache Server for Windows Little Black Book
(Publisher: The Coriolis Group)
Author(s): Greg Holden with Matthew Keller
ISBN: 1576103919
Publication Date: 01/01/99
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Recording Server Errors
In addition to support for the access log, Apache includes support for error logging among its core directives. The ErrorLog directive follows this syntax:
ErrorLog filename
The following also apply:
DefaultErrorLog logs/error.log
Contextserver config, virtual host
As with TransferLog and CustomLog, ErrorLog specifies the location of an error log file as being relative to the ServerRoot if the file name given does not begin with a forward slash (/).
The ErrorLog keeps track of every unsuccessful request that comes to Apache. You can control the amount of data that ErrorLog contains by using the LogLevel directive. The default argument to Log-Level is warn, which records only warnings sent by Apache to the client. The other values for LogLevel are:
alertAlert messages
critCritical messages
debugIncludes source file and line number where the message was generated to aid in debugging
emergEmergency messages
errorError messages
infoInformation messages
noticeNotification messages
Another directive, ScriptLog, is used to record error messages that result from scripts; for example:
ScriptLog logs/script.log
ScriptLog is not included by default; you have to add it to the configuration files. The specified file contains information that the script encounters with regard to the standard input (STDIN) and standard error streams (STDERR). (For more information on ScriptLog, see Chapter 7.)
Using Cookies To Track Users
Its likely that you are familiar with HTTP cookies because, although they are becoming increasingly popular as a way to track users to many Web sites, they have also generated controversy as a possible invasion of a users privacy.
An HTTP cookie is a bit of information that is transmitted from a server to a Web browser in the form of key/value pairs. If the cookie is accepted by the Web browser (and most of the latest Web browsers give users the option of declining cookies), it allows the server to remember something about the browser. The next time the browser visits the site that issued the cookie, the server retrieves the information on the cookie it sent earlier. With this information, the server can identify the user.
The Apache module mod_usertrack, which is included in the Windows version of Apache in the form of ApacheModuleUserTrack.dll, can be compiled into the server to add cookie functionality to the server (mod_usertrack is not compiled into Apache by default).
If you use ApacheModuleUserTrack.dll, you can use two cookie-related directives. The first, CookieTracking, lets you create cookies that uniquely identify your visitors. The other, CookieExpires, tells the browser to delete or expire the cookie after a certain period of time. To enable cookie tracking, follow these steps:
1. Open httpd.conf in Notepad.
2. Uncomment the following line:
#LoadModule usertrack_module modules/
ApacheModuleUserTrack.dll
3. Choose File|Save to save your changes.
4. Restart Apache.
5. Open srm.conf or httpd.conf and add the following to tell Apache to send cookies to clients:
CookieTracking on
CookieTracking follows this syntax:
CookieTracking on or off
In addition, the following apply:
Contextserver config, virtual host, directory, .htaccess
OverrideFileInfo
6. If you want to tell the browser how long it should keep the cookie before it is deleted, use the CookieExpires directive; for example:
CookieExpires "2 weeks"
CookieExpires is used as follows:
CookieExpires expiry-period
The following also applies:
Contextserver config, virtual host
With CookieExpires, you can specify the time as a number of seconds or as a string enclosed by double-primes. The string can specify years, months, weeks, hours, minutes, or seconds; for example:
CookieExpires 4000
CookieExpires "1 month 2 weeks 3 days 4 hours 10 minutes"
7. Choose File|Save to save your changes.
8. Restart Apache.
Keep in mind that simply compiling mod_usertrack does not activate cookies. To do so, you need to add the CookieTracking directive.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
239 242239 243242 btxt zal6242 atyt242 24402 (242)23 (239)242 btxt zal1240 24220 (242)242 gwyneddwięcej podobnych podstron