Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Logging script to be called from image tag

by Anonymous Monk
on May 20, 2005 at 11:25 UTC ( #458906=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

IS THIS SNIPPET CORRECT? ESPECIALLY WHERE IS
"<br />\n";

#!/usr/bin/perl # logger.cgi # version 1.0 # Create a file called main.log. Must have write permissions # set to main.log $mainlog = '/mnt/web_c/d31/s02/a000ras1/www/main.log'; $shortdate = `date +"%D %T %Z"`; chop ($shortdate); open (MAINLOG, ">>$mainlog"); print MAINLOG "Time: $shortdate\n"; print MAINLOG "User: $ENV{'REMOTE_IDENT'}"<br />\n"; print MAINLOG "Host: $ENV{'REMOTE_HOST'}"<br />\n"; print MAINLOG "Addr: $ENV{'REMOTE_ADDR'}"<br />\n"; print MAINLOG "With: $ENV{'HTTP_USER_AGENT'}"<br />\n"; print MAINLOG "Page: $ENV{'DOCUMENT_URI'}"<br />\n"; print MAINLOG "From: $ENV{'HTTP_REFERER'}"<br />\n"; close (MAINLOG); exit;
HOW TO MAKE TO RETURN A LOCATION HEADER THAT POINTS TO AN EXISTING IMAGE URL?
ITS NECESSARY TO CALL SCRIPT FROM AN IMAGE TAGS

Janitored by holli - retitled from IS THIS CORRECT? (4/10/2)

Comment on Logging script to be called from image tag
Select or Download Code
Re: IS THIS CORRECT?
by lupey (Monk) on May 20, 2005 at 11:35 UTC
    If you get rid of the quote (") before each of your <br />, then the script compiles file with 'perl -c'

    lupey

Re: IS THIS CORRECT?
by reasonablekeith (Deacon) on May 20, 2005 at 11:36 UTC
    PARDON?

    There is really no need to shout. People here have perfectly good hearing, and are happy to answer the most softly spoken questions.

    Anyway, "is it correct?". That depends on what it's supposed to be doing. What do you think it should do that it doesn't?

    As a starter, you have an odd number of double quotes in each print statement, you probably don't want to do that.

    ---
    my name's not Keith, and I'm not reasonable.

      Yes, thats was my mistake -no additional quotes required before <br />\n";

      also it need be the same in first row:
      print MAINLOG "Time: $shortdate <br />\n";

      But how to make call script from an image tags via implementing of return a location header that points to an existing image url?

        You could print A REDIRECTION HEADER (read the docs carefully)

            print redirect('http://somewhere.else/in/movie/land.jpg');
Re: IS THIS CORRECT?
by cog (Parson) on May 20, 2005 at 12:02 UTC
    IS THIS CORRECT?

    No, it isn't. Get rid of the all-capitals-bolded-redish sentences.

Re: IS THIS CORRECT?
by Fletch (Chancellor) on May 20, 2005 at 12:02 UTC

    I'm betting this is the same person that's been repeatedly trying to ask this same question (basically, "How do I make a 'web bug' image?") for weeks now. They've been given instructions how to do this and given alternate suggestions (like getting a real ISP that'll give them access to their logs). It's getting really annoying.

      This node was taken out by the NodeReaper on Fri May 20 09:41:57 2005 (EST)
      Reason: [Joost]: delete for obvious reasons

      For more information on this node visit: this

      I'd guess he's not the same person.

Re: IS THIS CORRECT?
by Joost (Canon) on May 20, 2005 at 12:10 UTC

      need real help.

        ++! I'm sorry but that is just way too funny to mod down. It reminds me of the Taxi episode where Reverend Jim is taking his drivers test:

        Reverend Jim: Pssssttt…what does the yellow light mean?
        Bobby Wheeler: "Slow down."
        Reverend Jim: What…does…the…yellow…light…mean?
        Bobby Wheeler: "Slow down"!
        Reverend Jim: Whaaaat…dooooeeees…theeeee…yeeeel-looowwww…liiiiight…meeeeaaan?

        -derby
Re: IS THIS CORRECT?
by Anonymous Monk on May 20, 2005 at 18:53 UTC
    You have 3 double quotes " on each of your print statements. Remove the middle quotes from each line (the one immediately before <br and you might have something that works. Dean.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://458906]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (12)
As of 2014-07-10 11:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (207 votes), past polls