Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 10th, 2000, 11:51 PM
Beaver Beaver is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 6 Beaver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
For privacy reason, I don't want to log the ip address of visitors. So that I use MD5->hexhash() to encrypt the ip address. I want to add a new environmental variable, which is the encrypted ip address, then I can log it.
Does anyone know how to add a new environmental variable, and how to log it?
Thanks.

Reply With Quote
  #2  
Old June 11th, 2000, 04:01 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>I don't want to log the ip address of visitors.
>>So that I use MD5->hexhash() to encrypt the ip address.

You can't decrypt the encrypted ip back to the original ip. So why do you have to log ip addresses at all? Just for curiousity? Will they be visible by everyone and not just yourself? Well, for whatever reason, here is the script anyway..

#!/usr/local/bin/perl
$log_file ="/path/to/log.txt";
$ip = $ENV{'REMOTE_ADDR'};
$salt = substr($ip,0,2);
$encrypted_ip = crypt($ip,$salt);
open(LOG,">>$log_file");
flock (LOG, 2);
print LOG "$encrypted_ipn";
close(LOG);
print "Content-type: text/htmlnn";
print "Hello World!";

Reply With Quote
  #3  
Old June 11th, 2000, 10:33 AM
Beaver Beaver is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 6 Beaver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The reason I wanna to use MD5->hexhash() to encrypt the ip is that we want to discriminate different users but don't want to know their identities. I want to replace the client ip address in the access_log with encrypted ip address. Would you tell me how to do it? Thanks.

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by freebsd:
>>I don't want to log the ip address of visitors.
>>So that I use MD5->hexhash() to encrypt the ip address.

You can't decrypt the encrypted ip back to the original ip. So why do you have to log ip addresses at all? Just for curiousity? Will they be visible by everyone and not just yourself? Well, for whatever reason, here is the script anyway..

#!/usr/local/bin/perl
$log_file ="/path/to/log.txt";
$ip = $ENV{'REMOTE_ADDR'};
$salt = substr($ip,0,2);
$encrypted_ip = crypt($ip,$salt);
open(LOG,">>$log_file");
flock (LOG, 2);
print LOG "$encrypted_ipn";
close(LOG);
print "Content-type: text/htmlnn";
print "Hello World!";
[/quote]


Reply With Quote
  #4  
Old June 11th, 2000, 02:39 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
access_log?? So you were talking about Apache then.

Well, you can't. You need a customize script for that. What you can do is to keep your acess_log untouched. Write a customize script to read access_log and print the encrypted IPs back to screen.

Reply With Quote
  #5  
Old June 11th, 2000, 03:05 PM
Beaver Beaver is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 6 Beaver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks. Freebsd.
I know that we can log any environmental variables. If we can set a new environmental variable, and set its value to be the encrypted ip address, then we can implement it. I have the perl encryption script already. I just dont' know how to add an environmental variable, and set its value to the result of a perl script.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by freebsd:
access_log?? So you were talking about Apache then.

Well, you can't. You need a customize script for that. What you can do is to keep your acess_log untouched. Write a customize script to read access_log and print the encrypted IPs back to screen.
[/quote]


Reply With Quote
  #6  
Old June 12th, 2000, 06:09 AM
Imo Imo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 1999
Posts: 33 Imo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
mod_rewrite for apache? you can do some funky stuff with that. Maybe write your own apache module? Or, why even log the ip at all?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > how to log new environmental variables?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway