EOF) {
list($valtoday)=$toddb->fields;
} else {
$valtoday=0;
}
$column = &$pntable['stats_date_column'];
$yesdb=$dbconn->Execute("SELECT $column[hits] as hits FROM $pntable[stats_date] WHERE $column[date]='".pnVarPrepForStore($yesdate)."'");
if(!$yesdb->EOF) {
list($valyesday)=$yesdb->fields;
} else {
$valyesday=0;
}
// Fetch some more infos about best and worst day ever
//
setlocale(LC_ALL, pnConfigGetVar('locale'));
$column = &$pntable['stats_date_column'];
$query = buildSimpleQuery('stats_date', array('date', 'hits'), '', "$column[hits] DESC", 1);
$dbr = $dbconn->Execute("$query");
list ($best_day_date, $best_day_hits) = $dbr->fields;
$best_day = mktime(0, 0, 0, substr($best_day_date, 2, 2), substr($best_day_date, 0, 2), substr($best_day_date, 4, 4));
$query = buildSimpleQuery('stats_date', array('date', 'hits'), '', "$column[hits] ASC", 1);
$dbr = $dbconn->Execute("$query");
list ($worst_day_date, $worst_day_hits) = $dbr->fields;
$worst_day = mktime(0, 0, 0, substr($worst_day_date, 2, 2), substr($worst_day_date, 0, 2), substr($worst_day_date, 4, 4));
// get all rows from the db at once and go through the result
$column = &$pntable['stats_hour_column'];
$result = $dbconn->Execute("SELECT $column[hits] FROM $pntable[stats_hour]");
$hour = 0; $sumhour = 0;
while (!$result->EOF) {
$hourhitamount[$hour] = $result->fields[0];
if ($hour == 0) {
$hourbesthits = $hourhitamount[$hour];
$hourbest = 0;
$hourbadhits = $hourhitamount[$hour];
$hourbad = 0;
}
if ($hourhitamount[$hour] > $hourbesthits) {
$hourbesthits = $hourhitamount[$hour];
$hourbest = $hour;
}
if ($hourhitamount[$hour] < $hourbadhits) {
$hourbadhits = $hourhitamount[$hour];
$hourbad = $hour;
}
$sumhour += $hourhitamount[$hour];
$hour++;
$result->MoveNext();
}
$result->Close();
// get all rows from the db at once and go through the result
$column = &$pntable['stats_week_column'];
$result = $dbconn->Execute("SELECT $column[hits] FROM $pntable[stats_week]");
$weekday = 0; $sumweek = 0;
while (!$result->EOF) {
$weekhitamount[$weekday] = $result->fields[0];
if ($weekday == 0) {
$weekdaybesthits = $weekhitamount[$weekday];
$weekdaybest = 0;
$weekdaybadhits = $weekhitamount[$weekday];
$weekdaybad = 0;
}
if ($weekhitamount[$weekday] > $weekdaybesthits) {
$weekdaybesthits = $weekhitamount[$weekday];
$weekdaybest = $weekday;
}
if ($weekhitamount[$weekday] < $weekdaybadhits) {
$weekdaybadhits = $weekhitamount[$weekday];
$weekdaybad = $weekday;
}
$sumweek += $weekhitamount[$weekday];
$weekday++;
$result->MoveNext();
}
$result->Close();
// get all rows from the db at once and go through the result
$column = &$pntable['stats_month_column'];
$result = $dbconn->Execute("SELECT $column[hits] FROM $pntable[stats_month]");
$month = 1; $summon = 0;
$monthbesthits = 0;
$monthbadhits = 0;
while (!$result->EOF) {
$monthhitamount[$month] = $result->fields[0];
if ($monthhitamount[$month] > $monthbesthits) {
$monthbesthits = $monthhitamount[$month];
$monthbest = $month;
}
if ($monthhitamount[$month] < $monthbadhits) {
$monthbadhits = $monthhitamount[$month];
$monthbad = $month;
}
$summon += $monthhitamount[$month];
$month++;
$result->MoveNext();
}
$result->Close();
include("header.php");
$column = &$pntable['counter_column'];
$result = $dbconn->Execute("SELECT $column[type], $column[var], $column[count] FROM $pntable[counter] ORDER BY $column[type] DESC");
if($dbconn->ErrorNo()<>0) {
echo $dbconn->ErrorNo(). ": ".$dbconn->ErrorMsg(). "
"; exit();
}
while(list($type, $var, $count) = $result->fields) {
$result->MoveNext();
/* Lets do one big switch instead of many if/then statements */
switch ($type) {
case "total":
switch ($var) {
case "hits":
$total = $count;
break;
}
case "browser":
switch ($var) {
case "Netscape":
$netscape[] = $count;
$netscape[] = substr(100 * $count / $total, 0, 5);
break;
case "MSIE":
$msie[] = $count;
$msie[] = substr(100 * $count / $total, 0, 5);
break;
case "Konqueror":
$konqueror[] = $count;
$konqueror[] = substr(100 * $count / $total, 0, 5);
break;
case "Opera":
$opera[] = $count;
$opera[] = substr(100 * $count / $total, 0, 5);
break;
case "Lynx":
$lynx[] = $count;
$lynx[] = substr(100 * $count / $total, 0, 5);
break;
case "Bot":
$bot[] = $count;
$bot[] = substr(100 * $count / $total, 0, 5);
break;
case "Other":
$b_other[] = $count;
$b_other[] = substr(100 * $count / $total, 0, 5);
break;
}
case "os":
switch ($var) {
case "Windows":
$windows[] = $count;
$windows[] = substr(100 * $count / $total, 0, 5);
break;
case "Mac":
$mac[] = $count;
$mac[] = substr(100 * $count / $total, 0, 5);
break;
case "Linux":
$linux[] = $count;
$linux[] = substr(100 * $count / $total, 0, 5);
break;
case "FreeBSD":
$freebsd[] = $count;
$freebsd[] = substr(100 * $count / $total, 0, 5);
break;
case "SunOS":
$sunos[] = $count;
$sunos[] = substr(100 * $count / $total, 0, 5);
break;
case "IRIX":
$irix[] = $count;
$irix[] = substr(100 * $count / $total, 0, 5);
break;
case "BeOS":
$beos[] = $count;
$beos[] = substr(100 * $count / $total, 0, 5);
break;
case "OS/2":
$os2[] = $count;
$os2[] = substr(100 * $count / $total, 0, 5);
break;
case "AIX":
$aix[] = $count;
$aix[] = substr(100 * $count / $total, 0, 5);
break;
case "Other":
$os_other[] = $count;
$os_other[] = substr(100 * $count / $total, 0, 5);
break;
}
}
}
$ThemeSel = pnUserGetTheme();
OpenTable();
OpenTable2();
echo "".pnConfigGetVar('sitename').' '._STATS."";
CloseTable2();
echo "
"._WERECEIVED." ".pnVarPrepForDisplay($total)." "
._PAGESVIEWS.' '.pnConfigGetVar('startdate').", ".pnVarPrepForDisplay($valtoday)." "
._MODTODAY." ".pnVarPrepForDisplay($valyesday)." "._MODYESTERDAY.".
"
._MOALLBESTDAY.ml_ftime(_DATELONG, $best_day)." (".pnVarPrepForDisplay($best_day_hits)." "._MODPAGES."), "
._MODWHILE." ".ml_ftime(_DATELONG, $worst_day)." (".pnVarPrepForDisplay($worst_day_hits)." "._MODPAGES
.") "._MOALLWORSTDAY.".
\n"
._MODON." ".pnVarPrepForDisplay($weekdaynames[$weekdaybest])." "
._MODTOTAL." ".pnVarPrepForDisplay($weekdaybesthits)." "._MODPAGES.", "._MODWHILE." "
.pnVarPrepForDisplay($weekdaynames[$weekdaybad])." "._MODISNTOURDAY." "
.pnVarPrepForDisplay($weekdaybadhits)." "._MODPAGES.". "._MODINAVRG." "
.pnVarPrepForDisplay($hourbesthits)." "._MODPAGES." "._MODAT." "
.pnVarPrepForDisplay($hourbest)." "._MODOCLOCK." "._MODFANSONLY." ".pnVarPrepForDisplay($hourbad)." "
._MODOCLOCK." "._MODWITHONLY." ".pnVarPrepForDisplay($hourbadhits)." "._MODPAGES.").";
CloseTable();
OpenTable();
OpenTable2();
echo ""._BROWSERS."";
CloseTable2();
echo "
\n";
echo " | "._MSIE.": | ".mk_percbar($msie[1],200,false,$ThemeSel,"$msie[1] %")." $msie[1] % ($msie[0]) |
\n";
echo " | "._NETSCAPE.": | ".mk_percbar($netscape[1],200,false,$ThemeSel,"$netscape[1] %")." $netscape[1] % ($netscape[0]) |
\n";
echo " | "._OPERA.": | ".mk_percbar($opera[1],200,false,$ThemeSel,"$opera[1] %")." $opera[1] % ($opera[0]) |
\n";
echo " | "._KONQUEROR.": | ".mk_percbar($konqueror[1],200,false,$ThemeSel,"$konqueror[1] %")." $konqueror[1] % ($konqueror[0]) |
\n";
echo " | "._LYNX.": | ".mk_percbar($lynx[1],200,false,$ThemeSel,"$lynx[1] %")." $lynx[1] % ($lynx[0]) |
\n";
echo " | "._SEARCHENGINES.": | ".mk_percbar($bot[1],200,false,$ThemeSel,"$bot[1] %")." $bot[1] % ($bot[0]) |
\n";
echo " | "._UNKNOWN.": | ".mk_percbar($b_other[1],200,false,$ThemeSel,"$b_other[1] %")." $b_other[1] % ($b_other[0])\n";
echo " |
";
CloseTable();
OpenTable();
OpenTable2();
echo ""._OPERATINGSYS."";
CloseTable2();
echo "
\n";
echo " | Windows: | ".mk_percbar($windows[1],200,false,$ThemeSel,"$windows[1] %")." $windows[1] % ($windows[0]) |
\n";
echo " | Linux: | ".mk_percbar($linux[1],200,false,$ThemeSel,"$linux[1] %")." $linux[1] % ($linux[0]) |
\n";
echo " | Mac/PPC: | ".mk_percbar($mac[1],200,false,$ThemeSel,"$mac[1] %")." $mac[1] % ($mac[0]) |
\n";
echo " | FreeBSD: | ".mk_percbar($freebsd[1],200,false,$ThemeSel,"$freebsd[1] %")." $freebsd[1] % ($freebsd[0]) |
\n";
echo " | SunOS: | ".mk_percbar($sunos[1],200,false,$ThemeSel,"$sunos[1] %")." $sunos[1] % ($sunos[0]) |
\n";
echo " | IRIX: | ".mk_percbar($irix[1],200,false,$ThemeSel,"$irix[1] %")." $irix[1] % ($irix[0]) |
\n";
echo " | BeOS: | ".mk_percbar($beos[1],200,false,$ThemeSel,"$beos[1] %")." $beos[1] % ($beos[0]) |
\n";
echo " | OS/2: | ".mk_percbar($os2[1],200,false,$ThemeSel,"$os2[1] %")." $os2[1] % ($os2[0]) |
\n";
echo " | AIX: | ".mk_percbar($aix[1],200,false,$ThemeSel,"$aix[1] %")." $aix[1] % ($aix[0]) |
\n";
echo " | "._UNKNOWN.": | ".mk_percbar($os_other[1],200,false,$ThemeSel,"$os_other[1] %")." $os_other[1] % ($os_other[0])\n";
echo " |
\n";
CloseTable();
OpenTable();
OpenTable2();
echo ""._MODBYHOUR."";
CloseTable2();
echo "
\n";
if (_24HOUR == true) {
for ($hour = 0; $hour < 24; $hour++) {
$percent = round((100*$hourhitamount[$hour])/$sumhour,2);
$label = "".pnVarPrepForDisplay($hour).":00 - ".pnVarPrepForDisplay($hour).":59";
echo "\t\n"
."\t\t| $label: | \n"
."\t\t".mk_percbar(round((100*$hourhitamount[$hour])/$hourbesthits,0),200,false,$ThemeSel,"$percent %")." \n"
."$percent % ($hourhitamount[$hour]) | \n"
."\t
\n";
}
} else {
for ($hour = 1; $hour < 24; $hour++) {
$percent = round((100*$hourhitamount[$hour])/$sumhour,2);
if ($hour < 13) $label = "".pnVarPrepForDisplay($hour)." am";
else $label = "".pnVarPrepForDisplay($hour % 12)." pm";
echo "\t\n"
."\t\t| $label: | \n"
."\t\t".mk_percbar(round((100*$hourhitamount[$hour])/$hourbesthits,0),200,false,$ThemeSel,"$percent %")." \n"
."$percent % ($hourhitamount[$hour]) | \n"
."\t
\n";
}
$percent = round((100*$hourhitamount[0])/$sumhour,2);
echo "\t\n"
."\t\t| 12 pm: | \n"
."\t\t".mk_percbar(round((100*$hourhitamount[0])/$hourbesthits,0),200,false,$ThemeSel,"$percent %")." \n"
."$percent % ($hourhitamount[0]) | \n"
."\t
\n";
}
echo "
\n";
CloseTable();
OpenTable();
OpenTable2();
echo ""._MODBYWEEK."";
CloseTable2();
echo "
\n";
for ($weekday=1;$weekday<=6;$weekday++) {
echo "\t\n"
."\t\t| $weekdaynames[$weekday]: | \n"
."\t\t".mk_percbar(round((100*$weekhitamount[$weekday])/$weekdaybesthits,0),200,false,$ThemeSel)." \n"
.round((100*$weekhitamount[$weekday])/$sumweek,2),"% ($weekhitamount[$weekday]) | \n"
."\t
\n";
}
echo "\t\n"
."\t\t| $weekdaynames[0]: | \n"
."\t\t".mk_percbar(round((100*$weekhitamount[0])/$weekdaybesthits,0),200,false,$ThemeSel)." \n"
.round((100*$weekhitamount[0])/$sumweek,2),"% ($weekhitamount[0]) | \n"
."\t
\n";
echo "
\n";
CloseTable();
OpenTable();
OpenTable2();
echo ""._MODBYMONTH."";
CloseTable2();
echo "
\n";
for ($month=1;$month<=12;$month++)
{
echo "\t\n"
."\t\t| $monthnames[$month]: | \n"
."\t\t".mk_percbar(round((100*$monthhitamount[$month])/$monthbesthits,0),200,false,$ThemeSel)." \n"
.round((100*$monthhitamount[$month])/$summon,2),"% ($monthhitamount[$month]) | \n"
."\t
\n";
}
echo "
\n";
CloseTable();
$unum_res = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[users]");
$column = &$pntable['stories_column'];
$anum_res = $dbconn->Execute("SELECT $column[aid], count(*) AS count FROM $pntable[stories] GROUP BY $column[aid]");
$snum_res = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[stories]");
$cnum_res = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[comments]");
$secnum_res = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[sections]");
$secanum_res = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[seccont]");
$subnum_res = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[queue] WHERE pn_arcd='0'");
$tnum_res = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[topics]");
$links_res = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[links_links]");
$cat_res = $dbconn->Execute("SELECT count(*) AS count FROM $pntable[links_categories]");
/* Now lets get the count info */
list($unum) = $unum_res->fields;
// $anum = $anum_res->PO_RecordCount();
list($snum) = $snum_res->fields;
list($cnum) = $cnum_res->fields;
list($secnum) = $secnum_res->fields;
list($secanum) = $secanum_res->fields;
list($subnum) = $subnum_res->fields;
list($tnum) = $tnum_res->fields;
list($links) = $links_res->fields;
list($cat) = $cat_res->fields;
OpenTable();
OpenTable2();
echo ""._MISCSTATS."";
CloseTable2();
$vlgn = "valign=\"bottom\"";
$algn = "align=\"right\"";
echo "
\n";
echo " | "._REGUSERS." | ".pnVarPrepForDisplay($unum)." |
\n";
echo " | "._STORIESPUBLISHED." | ".pnVarPrepForDisplay($snum)." |
\n";
echo " | "._SACTIVETOPICS." | ".pnVarPrepForDisplay($tnum)." |
\n";
echo " | "._COMMENTSPOSTED." | ".pnVarPrepForDisplay($cnum)." |
\n";
echo " | "._SSPECIALSECT." | ".pnVarPrepForDisplay($secnum)." |
\n";
echo " | "._ARTICLESSEC." | ".pnVarPrepForDisplay($secanum)." |
\n";
echo " | "._LINKSINLINKS." | ".pnVarPrepForDisplay($links)." |
\n";
echo " | "._LINKSCAT." | ".pnVarPrepForDisplay($cat)." |
\n";
echo " | "._NEWSWAITING." | ".pnVarPrepForDisplay($subnum)." |
\n";
echo " | "._NUKEVERSION." | ".pnConfigGetVar('Version_Num')."\n";
echo " |
\n";
CloseTable();
include 'footer.php';
?>serif" size="2">Domain
Name Registration
| |
| Internet
Marketing |
| |
Web
Site Design |
|
| Email
only Accounts |