Hit viewer
Hits' ;
$result = mysqli_query($link,"SELECT * FROM " . $dbtablehits . " ORDER BY count DESC");
echo "
";
echo '
Page
Hits
' ;
// keeps getting the next row until there are no more to get
while($row = mysqli_fetch_array( $result ))
{
// Print out the contents of each row into a table
echo '
';
echo $row['page'];
echo '
';
echo $row['count'];
echo '
';
}
echo "
Total Hits
$totalhits
" ;
echo "
";
// ############################
// ### get total unique IPs ###
// ############################
$result=mysqli_query($link,"SELECT MAX(id) FROM info");
while ($row = mysqli_fetch_array($result, MYSQL_NUM))
{
$totalips = $row[0] ;
}
// ########################
// ### Display visitors ###
// ########################
echo '
Visitors
' ;
$result = mysqli_query($link,"SELECT * FROM $dbtableinfo ORDER BY id DESC")
or die(mysqli_error());
echo "
";
echo "
Total unique IP´s
$totalips
" ;
echo '
IP
User agent
Date & Time
Country
';
// keeps getting the next row until there are no more to get
while($row = mysqli_fetch_array( $result ))
{
// Print out the contents of each row into a table
echo '
';
echo $row['ip_address'];
echo '
';
echo $row['user_agent'];
echo '
';
echo $row['datetime'];
echo '
';
echo getCountryFromIP($row['ip_address'], " NamE ");
echo "