Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visitants log by using CGI

Status
Not open for further replies.

cadbilbao

Programmer
Joined
Apr 9, 2001
Messages
233
Location
ES
Hi!

I've got a website hosted on Solaris/Zeus server with CGI.

I would like to install a counter or a CGI to get the visitants log.

Is it possible? Does anyone know a good piece of code?

Thank you.
 
1) I created this piece of code (/cgi-bin/log.pl)

$log = "/__/foo/log.html";
$getdate = `date +"%D %T %Z"`;
chop ($getdate);
open (LOG, ">>$log");
print "Content-type: text/html\n\n ";
print LOG &quot; [ <B>Time:</B> $getdate ] - \n&quot;;
print LOG &quot; [ <B>With:</B> $ENV{'HTTP_USER_AGENT'} ] - \n&quot;;
print LOG &quot; [ <B>Host:</B> $ENV{'REMOTE_HOST'} ] - \n&quot;;
print LOG &quot;[ <B>From:</B> <A HREF=$ENV{'HTTP_REFERER'}>$ENV{'HTTP_REFERER'}</A> ]<BR>\n\n&quot;;
close (LOG);
exit;

2) I did chmod it 777
3) I created an empty file /__/foo/log.html
4) I did chmod both directory and file 777
5) I inserted into 'index.html':

<!--#exec cgi=&quot;/__/cgi-bin/log.pl&quot;-->


But I access my 'index.html' and when browsing log.html, there is nothing... what am I doing wrong???
 
I haven't written a visitor log script myself, but i have been doing some similar things with logging other stuff and using SSI, (although on NT),.....AND it's just a thought, but check your server is configured to run SSI 'exec' commands, as there have been issues with security on some web servers.
 
Try taking the pathname part out of your #exec statement. Just make it:
Code:
<!--#exec cgi=&quot;log.pl&quot;-->

I think that exec cgi requires that the program be in your cgi directory (which it appears it is).
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top