Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
We don't bite newbies here... much
 
PerlMonks  

RE: Poor Man's Web Logger

by providencia (Pilgrim)
on Apr 11, 2000 at 19:42 UTC ( #7314=note: print w/ replies, xml ) Need Help??


in reply to Poor Man's Web Logger

I can't seem to get this script to work.
I'm a newbie to perl and programming so this could explain alot.
What tag do I put in the html?
The tag below doesn't make sense to me.
<img src="/cgi-bin/showpic/path_to_pic_in_document_root/pic.jpg">
Let's say my image is /home/username/www/cgi-bin/showpic/spacer.gif
I'm confused.
I know I'm beating myself up somewhere.
At what point am I making this harder than it needs to be?


Comment on RE: Poor Man's Web Logger
Download Code
RE: RE: Poor Man's Web Logger
by btrott (Parson) on Apr 11, 2000 at 20:18 UTC
    The idea behind this is that you typically already have images on your web page; so you replace the SRC of one of the images with a URL that routes through this logger, but still returns the image. So the browser doesn't know the difference, but the server does.

    So what you should actually do is just use one of the images you already have on your site. You say that the image you want to use is at /home/username/www/cgi-bin/showpic/spacer.gif? That's not right. "showpic" is the name of the CGI script, so it can't also be a directory on the filesystem.

    Let's say that you currently have an image like this on your web page:

    <img src="/images/foo.gif">
    And the actual filesystem location of this image is:
    /home/bar/www/images/foo.gif
    You would replace the IMG tag with this:
    <img src="/cgi-bin/showpic/images/foo.gif">
    And, in showpic (the CGI script), you'd set the $home variable to:
    my $home = "/home/bar/www";
    Make sense?
Explanation of $home in PMWL
by comatose (Monk) on Apr 11, 2000 at 22:49 UTC

    After reading your problem, the $home variable really serves to save you from giving yourself carpal tunnel syndrome from typing out the full path.

    For a moment, let's say you keep all your images to your site in the filesystem path /home/username/www/images/. Your web-based path to the script might be /cgi-bin/showpic. Now you want to log who is visiting each of your pages using this script without putting the same image on every page.

    You could then set $home equal to '/home/username/www/images'. Then for each image that you want to have generate an entry in the log, you would set the src to '/cgi-bin/showpic/myHead.jpg' or '/cgi-bin/showpic/myHouse.jpg' or whatever.

    However, if you have images all over your filesystem, you might set $home to '/home/username/www'. Then you image src could be '/cgi-bin/showpic/images/myHead.jpg' or '/cgi-bin/showpic/britain/bigben.jpg' or any other image you have on a page you want to log.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-04-18 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (463 votes), past polls