
terrill
User
Aug 4, 2002, 11:36 AM
Post #1 of 5
(4408 views)
Shortcut
|
Who's been editing? (i.e. an audit log)
|
Can't Post
|
|
Would ya like a record of who's been to your log-in page? Or for that matter, any particular page? Assume you have your editors going to your domain/article manager URI at: http://www.yourplace.com/authors Yeah, currently, they need to remember the ugly stuff to get to admin.cgi, but... In your "authors" directory, you create an index.cgi that creates a log and redirects the visitor to the admin.cgi script using the following code: --- CODE STARTS HERE --- #!/usr/bin/perl use Socket; # get the visitor's ISP... @a=split(/\./,$ENV{'REMOTE_ADDR'}); $addr=pack('C4',@a); ($isp,$alias,$adrtype,$length,@address)=gethostbyaddr($addr,AF_INET); open(F, ">>mylog.txt"); print F $isp . '~' . $ENV{'REMOTE_ADDR'} . "\n"; close(F); my $url = 'http://www.yourplace.com/authors/cgi-bin/artman/exec/admin.cgi'; print "Location: $url\n\n"; exit; --- CODE ENDS HERE --- You log file (mylog.txt) might have something like my ISP/IP info: dpc6682009013.direcpc.com~66.82.9.13 The above assumes two things: 1) Your Hosting Service puts index.cgi in its configuration so it's a valid default page. If not, just add the index.cgi to the URI you give your authors... problem solved. 2) Your ISP allows your cgi scripts to access the Perl Socket.pm module. Now, it ain't bullet-proof, but... you've (probably) just captured the visitors ISP/IP information! You will get their IP, even if it's actually the IP of a proxy server or firewall. You may not get their ISP name... depends on if the IP can be successfully converted to a recognizable name. But, if you add the date/time to the log, you'll eventually be able to identify visitors with IP's when they do something on your site, like add an article and comparing the article time with the log times. Just a thought! Oh, and... if you take this idea, combine it with the "Auto Thumbnail" idea, add a little boring study time on GD.pm on writing text to an image... you can produce a graphic image that tells your visitors their IP address and ISP. Now, if you add the ability to create sockets with say, Whois... ya might be able to tell 'em what city they're in! Now, add NetBIOS nbname, maybe get their REAL name from their computer... Ah, too much like fun, isn't it? I love the Internet; such a nice place to visit! Enjoy your logfile. Maybe in a future release, Interactive will add an audit log??? Enjoy!!! -- Terrill -- [quote] "Evaporating expectations of quality: 1980's paradigm: If it's worth implementing once, it's worth implementing twice. 1990's paradigm: Ship the prototype! 2000's paradigm: Ship the idea!" ---Larry Rosler: http://www.perl.com/pub/a/2000/06/rosler.html [/quote]
(This post was edited by terrill on Aug 4, 2002, 12:14 PM)
|