dimanche 27 mars 2011

Create a referrer list on your blog in 10 minutes. — Wohill

Create a referrer list on your blog in 10 minutes. — Wohill: "Create a referrer list on your blog in 10 minutes.

by Niklas Waller on February 17, 2009

in PHP

If you would like to have a list of the say 10 or 20 latest referrers to your blog or site, it is quite easy to accomplish a simple solution pretty quickly. Here’s an easy and fast way of how to do it with PHP and MySQL.

1. Create a new table in your MySQL database called ‘referrers’ with these fields and properties. This is the place where all data about referrers and requested content will be stored.
id : int (10) primary key auto-increment
referrer: varchar (500)
request varchar (100)

2. Paste this script to the page where the visitors arrive. Each time someone is referred to this blog a new entry is created in the MySQL table.


3. Paste this piece of code where you want the referrer list to be on your site.
%s
”, $row['referrer'], “REFERRER ‘” . $row['referrer'] . “‘ REQUESTED ‘” . “YOUR_DOMAIN” . $row['request'] . “‘”, substr($row['referrer'], 0, 25));
}
?>

Take a look at the bottom right of Wohill to see this in action!

– Envoyé à l'aide de la barre d'outils Google"

Aucun commentaire:

Enregistrer un commentaire