View Single Post
Old 05-02-2007, 03:14 PM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,091
Quote:
Originally Posted by DrCocker View Post
I am renting space through a friend who is hosting. He rents from some place in NL I believe, but I don't know the name offhand.

There is an old version of Webalizer on there that I have access to by default, (but it doesn't show me IP addresses accessing specific files such as an image, just the referring URL) but if I could find a good one, I could install it myself. On my server I am allowed to use php/javascript/etc., but no ASP/ASP.NET etc.

I'd really appreciate if you could point out a specific analyzer or simple little script that would do this. For some reason it doesn't seem very difficult at all, but it is eluding me.
On your server:

Create a folder inside the domain space you will host the image on.
Set the security on the folder to 777 (writable)
inside the folder create an .htaccess file to redirect any image calls to a script name.
in the same folder create a script that writes a time stamp and the incoming ip to a text file and then serves up the image.

htaccess:

AuthUserFile /dev/null
AuthGroupFile /dev/null

RewriteEngine On
ReWriteRule .*\.(jpg|gif)$ http://www.your_domain_name.com/fold...scrip_name.php [R,L]

in the script:

<?php
$fp=fopen('testit.txt','a');
if ($fp>0)
{
fwrite($fp, date("F j, Y, g:i a") . " " . $_SERVER['REMOTE_ADDR'] . "\n");
fclose($fp);
}
header("Location: http://www.your_domain_name.com/image_to_return.jpg");
?>

This will log each hit and show you the datetime and ip of the hit.

Make sure not to put the image you are returning in the same folder as the script and htaccess, because you are redirecting all image hits you will end up going around and around and around.

Anytime you want to reset it, just delete the file you are writing to and it will recreate itself on the next hit.

When you want to look at the ips, just go to the file.

Test of concept:

http://www.sigamatic.com/testarea/anyoldimagewilldo.jpg

file being created http://www.sigamatic.com/testarea/testit.txt


Hope this helps, sorry I took so long to get back, sort of forgot about it till you bumped it
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook