This last posting is much better Anonymous Monk, thank you.
Posting a new question as a reply to a previous question is not the best way to get a quality response. Many Monks have become bored by now and have not read all the replies. This last post is written well enough to deserve a new node in SoPW.
Please, feel free to obtain a Perlmonk username. That way I don't have to call you Anonymous Monk.
"Its a good practice to improve the old concepts,codes, not all people can this."
Perhaps, but it is less atractive to post old scripts here. We are more interested your level of understanding of the code. Seeing a script which the poster didn't write leads us to believe ( perhaps incorrectly ) the poster doesn't understand the code and has not taken the time to understand the code. Thus we Monks are less likely to take the time to understand what the poster is saying.
"Can the logfiles and hostfiles be placed in www directory,not in cg-bin"
They could be placed in any directory to which you're CGI script has read/write privleges. Usually, your host has very specific requirements as to where you can and cannot write files.
Before posting, please run your scripts through perltidy. This:
@tl=(85,78,73,46,68,69); ($gothostbyaddr) && ($head=$gothostbyaddr);
if (length($ENV{QUERY_STRING})>1) { $reff=$ENV{QUERY_STRING}; } else
{$reff=$ENV{HTTP_REFERER};
$reff=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
} $head.=" $reff";
Becomes this:
@tl = ( 85, 78, 73, 46, 68, 69 );
($gothostbyaddr) && ( $head = $gothostbyaddr );
if ( length( $ENV{QUERY_STRING} ) > 1 ) { $reff = $ENV{QUERY_STRING};
+}
else {
$reff = $ENV{HTTP_REFERER};
$reff =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
}
$head .= " $reff";
So very much easier to read and even gives the reader the impression that you actually know what you are doing.
"what be the right way to implement calling this script from image tags"
<img src="http://www.yoursite.com/cgi-bin/logs.pl" height="1" width="1">
I don't understand what you mean by "calling this script from image tags, not from SSI". If you are calling the script from an image tag then that constitutes a Server Side Include. Perhaps if you can outline the process steps you want to execute? Do you mean "deliver executeable payload via image upload" as in a trojan?
If your script doesn't include these lines:
use warnings;
use strict;
That tells us you haven't used the best tool available for finding errors in your script. Perl is the best tool available for finding errors in your scripts. Use warnings.
"need help to exclude own IP from logging."
Either of the block formats you presented is acceptable. Perhaps
unless ($ENV{REMOTE_ADDR} =~ ?10.10.0.1?){
...
}
is more perl like.
s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s
|-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,,
$|=1,select$,,$,,$,,1e-1;print;redo}
|