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}

In reply to Re^3: Making script called from image tags by starbolin
in thread Making script called from image tags by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.