
Traffic Log
First rule, you must have an access to your web database (phpmyadmin). For example, if your web hosted in blogspot.com (eg. http://yourwebname.blogspot.com) or wordpress.com (eg. http://yourwebname.wordpress.com), you don’t have an access to your web database. In my case, I use wordpress engine that can be download from http://wordpress.org and host it to a free web hoster, http://0fees.net.
Second step, access to your web database and make new table “wp_traffic” with 4 column :
- id : int(100), auto_increment, primary key
- ip : varchar(100)
- referer : varchar(100)
- waktu : varchar(100)
Then, put this code wherever you like on your web
<h2>Traffic Log</h2>
<?php
$waktu = date("d/n/y - H:i:s");
$count = mysql_num_rows(mysql_query("SELECT * FROM wp_traffic"));
$hariIni = date("j/n/Y");
$ip = $_SERVER['REMOTE_ADDR'];
if
( mysql_num_rows
( mysql_query
( "SELECT * FROM wp_traffic WHERE ip = '$_SERVER[REMOTE_ADDR]'")) == 0
and $_GET["admin"] != "true"
and !eregi("admin", $_SERVER["HTTP_REFERER"])
)
{ if (!eregi("http://www.maisbiz.0fees.net", $_SERVER["HTTP_REFERER"]))
{
mysql_query
( "INSERT INTO wp_traffic (ip, referer, waktu) VALUES ('$_SERVER[REMOTE_ADDR]',
'$_SERVER[HTTP_REFERER]', '$waktu')") or die(mysql_error());
}
else
{
mysql_query
( "INSERT INTO wp_traffic (ip, referer, waktu) VALUES ('$_SERVER[REMOTE_ADDR]',
'', '$waktu')") or die(mysql_error());
}
}
$qTraffic = mysql_query
( "SELECT * FROM wp_traffic ORDER BY id DESC LIMIT 0,7") or die(mysql_error());
while ($aTraffic = mysql_fetch_array($qTraffic))
{
if ($aTraffic["referer"] != "")
{
$referer = parse_url($aTraffic["referer"], PHP_URL_HOST);
echo "
<li><font color=#307f95><b>$aTraffic[ip]</b></font><br />
from $referer<br />
on $aTraffic[waktu]</li>
";
}
else
{
echo "
<li><font color=#307f95><b>$aTraffic[ip]</b></font><br />
on $aTraffic[waktu]</li>
";
}
}
echo "<i>Traffic Log Credits : Hadoitz</i>";
?>
Note : Learn the code, then recoded based on your web configuration.











































nice artikel om
mantap nih bisa langsung dcoba nih (^_^)
@ kuere
hehehee.. klo postingan pemrograman pasti lgsg tertarik..
nice post friend.. keep sharing thanks. good luck for you…
thanks, good luck for you too..
kaga ngerti ane…bhs na lain…:(
ajarin bikin User Online juga dunk…trims
mantap nih bisa langsung dcoba nih
I’m not a coder but if you are using wordpress then I think there are plugins that can handle that sort of thing, right?
Yup, there is a lot of plugin to do that. But I prefer simple code to do it, so I know how the code is work.
Thanks for visiting Layla..