以下为建立一个访问计数器的程序,可以参照:
const
lastip:string='0:0:0:0'; //避免重复计数
var
s:string;
count:integer;
begin
s:=request.cookiefields.values['count'];
if s<>'' then begin
try
count:=strtoint(s);
except
count:=0;
end;
end else count:=0;
if lastip<>request.remoteaddr then inc(count);
lastip:=request.remoteaddr;
response.setcustomheader('set-cookie','count='+inttostr(count)+'; expires=sun, 21 feb 2010 08:08:08 gmt');
response.content:='您是第'+inttostr(count)+'来到本页!';
end;
(以上程序用win95b的个人web服务器+netscape navigator 4.04调试通过)