I have the code below which shows visitors online. It used to work just fine but I don't know what happened and now sometimes shows the name of the blog the visitor viewing and sometimes just a number. Also it does not show me in the list as it used to.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/xhtml+xml; charset=iso-8859-1" />
<title>Online Activity</title>
<meta name="description" content=" Real-time Visitor's List " />
<meta name="keywords" content=" A listing of current website visitors, a flag for their country and what page they are reading " />
<meta http-equiv="imagetoolbar" content="no">
<style type="text/css">
#body {
font-family:verdana,sans-serif;
font-size:76%;
color:#000;
text-align:left;
padding:2px 4px;
background-color:#eee;
}
#wrapper {
width:400px;
margin:auto;
position:relative;
z-index:0;
}
#container {
padding:0;
position:relative;
z-index:1;
text-align:left;
overflow:auto;
}
img.globe {
position:absolute;
bottom:0px;
right:0px;
z-index=-1;
}
a {
color:blue;
text-decoration:none;
padding: 2px 4px;
}
a:link:hover {
color:#0000ff;
background:#fcf;
border:1px solid #939;
padding: 1px 3px;
}
a:link:visited {
text-decoration:none;
color:blue;
padding: 2px 4px;
}
a:visited:hover {background:#fcf;
border:1px solid #969;
padding:1px 3px;}
a.ext:link:hover {
background-color:#cfc;
border:1px solid #030;
background-image:
url(../../_img/web/extLink.gif);
background-repeat:no-repeat;
background-position:100% 0px;
padding:1px 5px 1px 3px;
margin-right:-2px; }
a.ext:visited:hover {
background-color:#cfc;
border:1px solid #030;
background-image:
url(../../_img/web/extLink.gif);
background-repeat:no-repeat;
background-position:100% 0px;
padding:1px 5px 1px 3px;
margin-right:-2px;
}
p#colHead {
padding:5px 0 0 0;
margin:0 0 -5px 0;
font-family:georgia,times,serif;
color:#999;
font-weight:bold;
}
span#userNo {
padding-left:auto;
padding-right:30px;
cursor:help;
}
span#loc {
padding-left:auto;
padding-right:40px;
text-align:center;
cursor:help;
}
span#active {
padding-left:auto;
padding-right:45px;
text-align:center;
cursor:help;
}
span#file {
padding-left:auto;
padding-right:60px;
cursor:help;
}
span.num {
padding-left:auto;
font-family:georgia,times,serif;
text-align:center;
font-size:160%;
font-weight:bold;
color:#999;
}
span.time {
padding-left:0cm;
padding-right:0px;
text-align:center;
cursor:help;
}
//img.flag {
border:none;
padding:5px 10px;
margin:0 0 0 0;
position:relative;
top:7px;
}//
.center {
margin:auto;
text-align:center;
padding:5px;
}
p.center {
margin:20px;
}
#box {
border:1px solid #666;
background:#eee;
}
/* #wrapper {
margin:auto;
border:1px solid #369;
background:#eee;
}*/
h1 {
font-family:georgia,serif;
font-size:100%;
text-align:center;
margin:0;
padding:3px 0 0 0;
}
p.colHead {
margin:0;
padding:0;
}
// added by KSK for the table
.ws6 {font-size: 8px;}
.ws7 {font-size: 9.3px;}
.ws8 {font-size: 11px;}
.ws9 {font-size: 12px;}
.ws10 {font-size: 13px;}
.ws11 {font-size: 15px;}
.ws12 {font-size: 16px;}
.ws14 {font-size: 19px;}
.ws16 {font-size: 21px;}
.ws18 {font-size: 24px;}
.ws20 {font-size: 27px;}
.ws22 {font-size: 29px;}
.ws24 {font-size: 32px;}
.ws26 {font-size: 35px;}
.ws28 {font-size: 37px;}
.ws36 {font-size: 48px;}
.ws48 {font-size: 64px;}
.ws72 {font-size: 96px;}
.wpmd {font-size: 13px;font-family: 'Arial';font-style: normal;font-weight: normal;text-decoration: none; vertical-align: bottom;}
.wplb {font-size: 13px;font-family: 'Arial';font-style: normal;font-weight: bold;text-decoration: none;}
</style>
</head>
<body id="body">
<div id="wrapper">
<div align= "center">
<img class="globe" src="http://www.alkhater.net/blog/img/globe3.jpg" alt=""/>
</div>
<div id="container">
<h1>User Activity: What Where & for How Long?</h1>
<?php
include("/home/alkha4/public_html/blog/addOns/visitors/geoip.inc");
$gi = geoip_open("/home/alkha4/public_html/blog/addOns/visitors/GeoIP.dat",GEOIP_STANDARD);
// Attach DB
mysql_connect("localhost","********","********") or die("Unable to connect to database");
mysql_select_db("********") or die("Wrong DB");
// Create temp DB & run subquery in MySQL 4.0.25 (must wait till v4.1 to run in a single query)
// See http://dev.mysql.com/doc/mysql/en/example-maximum-column-group-row.html
mysql_query('drop table Evo_onlineTemp');
mysql_query('create table Evo_onlineTemp ( ip varchar(40), timestamp integer(15), primary key (timestamp), index(ip) )');
mysql_query('insert into Evo_onlineTemp (ip,timestamp) select ip, max(timestamp) from Evo_online group by ip');
$getEM = mysql_query('select Evo_online.ip, file, totIP, Evo_online.timestamp, Evo_online.init from Evo_online, Evo_onlineTemp where Evo_online.ip=Evo_onlineTemp.ip and Evo_online.timestamp=Evo_onlineTemp.timestamp');
//$getEM = mysql_query('select s1.ip, s1.file, s1.totIP, s1.timestamp, s1.init, count(*) as x from Evo_online s1 inner join Evo_online s2 on s1.ip=s2.ip group by s1.ip,s1.file,s1.totIP,s1.init,s1.timestamp having s1.timestamp=max(s2.timestamp)');
echo '<br />';
//echo '<div id="table1" style="left:10px; top:30px; width:600px; height:60px; z-index:0">';
//echo '<div class="wpmd">';
echo '<TABLE >';
echo '<TR valign=top>';
echo '<TD width=25 bgcolor="#C0C0C0">';
echo '<div class="wplb">';
echo '<div align=center> #</div>';
echo '</div>';
echo '</TD>';
echo '<TD width=202 bgcolor="#C0C0C0">';
echo '<div class="wplb">';
echo '<div align=center> Location</div>';
echo '</div>';
echo '</TD>';
echo '<TD width=60 bgcolor="#C0C0C0">';
echo '<div class="wplb">';
echo '<div align=center>Time</div>';
echo '</div>';
echo '</TD>';
echo '<TD width=244 bgcolor="#C0C0C0">';
echo '<div class="wplb">';
echo '<div align=center>Latest Activity</div>';
echo '</div>';
echo '</TD>';
$tot=0;
while ($EM = mysql_fetch_array($getEM)) {
$tot++;
$cID=strtolower(geoip_country_code_by_addr($gi,"$EM[totIP]"));
$cName=geoip_country_name_by_addr($gi, "$EM[totIP]");
$file =$EM[file];
if ($cID !="") {
echo '<TR valign=top>';
echo '<TD width=25 bgcolor="#C0C0C0">';
echo '<div class="wpmd">';
echo '<div align=center>';
echo $tot;
echo '</div>';
echo '</div>';
echo '</TD>';
echo '<TD width=202 bgcolor="#C0C0C0">';
echo '<div class="wpmd">';
echo '<div align=left>';
if ($cID=="") {
echo '<img class="flag" src="http://www.alkhater.net/blog/addOns/visitors/flags/a1.gif" alt="flag" title=" Unkown " />';
} else {
echo '<img class="flag" src="http://www.alkhater.net/blog/addOns/visitors/flags/'.$cID.'.gif" alt="flag "/> '.$cName;
}
echo '</div>';
echo '</div>';
echo '</TD>';
echo '<TD width=60 bgcolor="#C0C0C0">';
echo '<div class="wpmd">';
echo '<div align=center>';
if ($EM[4]=="2144444444") {
$time=5;
echo "new";
} else {
$time=round(($EM[3]-$EM[4])/60);
echo $time;
}
echo '</div>';
echo '</div>';
echo '</TD>';
echo '<TD width=244 bgcolor="#C0C0C0">';
echo '<div class="wpmd">';
echo '<div align=center>';
if ($file=="") {
echo 'Browsing the Main Page<br />';
}
elseif ($file=="index.php") {
echo 'Browsing the Main Page<br />';
}
elseif ($file=="articles_stub.php") {
echo 'Browsing Articles<br />';
}
elseif ($file=="gems_stub.php") {
echo 'Browsing the Gems<br />';
}
elseif ($file=="po_stub.php") {
echo 'Browsing Poetry<br />';
}
elseif ($file=="q_stub.php") {
echo 'Browsing Quoations<br />';
}
elseif ($file=="bwb_stub.php") {
echo 'Browsing A Blog within Blog<br />';
}
elseif ($file=="sel_stub.php") {
echo 'Browsing Selected Articles by Others<br />';
}
elseif ($file=="link_stub.php") {
echo 'Browsing Linkblogs<br />';
}
elseif ($file=="about_stub.php") {
echo 'Browsing About Me!<br />';
}
elseif ($file=="gcom_stub.php") {
echo 'Browsing the general comments<br />';
}
elseif ($file=="aboutblog_stub.php") {
echo 'Browsing About This Blog!<br />';
}
else {
$title=str_replace("_"," ",$file);
echo '<a class="ext" href="http://www.alkhater.net/blog/index.php/'.$EM[file].'" title=" go to entry: '.ucwords(strtolower($title)).' ">'.ucwords(strtolower($title)).'</a><br />';
}
echo '</div>';
echo '</div>';
echo '</TD>';
} }
echo '</TABLE>';
//echo '</div>';
mysql_free_result($getEM); // release result
echo '<br />';
echo '<br />';
?>
<!--<p class="center"><span id="box"><a href="javascript:self.close()">Close Window</a></span></p>-->
</div></div>
</body>
</html>
Sorry i've tried to attach the code as file but it did not work. I really would appreciate all the help.
I didn't look at the code because "Who's online" is part of the latest and greatest versions. Upgrading to 1.8.6 is a good ideathen?