archive about

Other people's ( blogs

Notice: The following tutorial is not to be used in ways that are against the law. It only demonstrates a problem that can be caused by the way uses profile images. A similar technique is used by many ad services.

Suppose you want more info on the traffic, or even trying to find out the real identity of a blogger who maintains a blog at -or even their visitors. How can you do this? Here is a simple step-by-step recipe....

What you need (other ingredients can be used too, this is just an example): 1 server running PHP + MySQL 1 account

Cooking: - Choose the jpeg image you will use for your profile "photo" (preferably one not bigger than 64x64). Let's say photo.jpg - Upload this photo at your server. Let's say the address is http://myserver/mydir/photo.jpg - Create the following table at your MySQL db:

create table blogger_stats(dt timestamp, ip varchar(27), 
page varchar(255), agent varchar(255)) ;
- Create the following php script, and upload it as http://myserver/mydir/photo.php
require_once 'DB.php' ;
$DSN = "mysql://dbuser:dbpass@localhost/dbname";
$bit_db = DB::connect($DSN);
$res=$bit_db->query("INSERT INTO blogger_stats(ip, page, agent) 
header ('Content-Length: ' . filesize('./photo.jpg') ) ;
header('Content-Type: image/jpeg') ;
readfile('./photo.jpg') ;
- If there is not a .htaccess file in this directory, create an empty one. - put the following lines in this .htaccess file:
RewriteEngine On
RewriteRule ^photo.jpg      photo.php
- Now use http://myserver/mydir/photo.jpg as your photo in your profile.

You are ready!

Just put a comment in any post you want to "keep an eye". Every time someone visits the comments page, you will have a new entry in the blogger_stats table. Actually this is a nice way to keep your blog's stats too (this is how it started for me)!

(The technique can be improved with the use of cookies, but this is out of the scope of this article!)