Elijah has asked for the wisdom of the Perl Monks concerning the following question:
Here is the script.
#!/usr/bin/perl $file = "/home/master/temp/perlskripts_ip.log"; $visited = "/home/master/temp/count.log"; $time = `date`; if ($ENV{'REMOTE_ADDR'} !~ /192.168.0.(\d+)/) { if (!-e $file) { `touch $file`; } open(lg, ">>$file") || die "Can't open $file!\n"; print lg "User from ".$ENV{'REMOTE_ADDR'}." logged on ".$time; close(lg); if (!-e $visited) { `touch $visited`; } open (vis, "<$visited") || die "Cannot open $visited for reading!\n +"; $count = <vis>; close (vis); print "count is ".$count,"\n"; open (vis, ">$visited") || die "Cannot open $visited for writing!\n +"; if ($count ne "") { $count++; }else{ $count = 1; } print vis $count; close (vis); }
and here is how I call it on my page
I really do not want to incorporate cgi unless I have to. Any ideas?<img src="/cgi-bin/user_log.cgi" height="2" width="2" alt="[script]">
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Return script value in html?
by Roger (Parson) on Jan 23, 2004 at 00:23 UTC | |
|
Re: Return script value in html?
by b10m (Vicar) on Jan 23, 2004 at 00:03 UTC |