Viewing file: index.php (17.13 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
session_start();
include("config.php");
$pass = addslashes(substr($_REQUEST[password],0,20));
if($_REQUEST[logout]) $_SESSION[pcs]="";
if($_REQUEST[login]=="login"){
if($password==$pass){
$_SESSION[pcs]=$password;
}else{
$error = "<br><span class=error><b>-!! sorry, wrong password !!-</b></span><br><br>";
}
}
?>
<html>
<head>
<title>PHPCounterSmart <?=$version?> - <?=$website?></title>
<style>
.small, .small a {
font-size: 9px;
color: #003366;
font-weight: normal;
font-family: Helvetica, Arial;
text-decoration: none;
}
.text, .text a {
font-size: 11px;
color: #003366;
font-weight: normal;
font-family: Helvetica, Arial;
text-decoration: none;
}
.textfett, .textfett a {
font-size: 11px;
color: #003366;
font-weight: bold;
font-family: Helvetica, Arial;
text-decoration: none;
}
input {
font-size: 11px;
border-style:solid;
border-width:1px;
border-color:#00CCFF;
color: #003366;
font-weight: normal;
font-family: Helvetica, Arial;
text-decoration: none;
width:100%;
}
select {
font-size: 11px;
border-style:solid;
border-width:1px;
border-color:#00CCFF;
color: #003366;
font-weight: normal;
font-family: Helvetica, Arial;
text-decoration: none;
width:100%;
}
.navi, .navi a {
font-size: 13px;
color: white;
font-weight: bold;
font-family: Helvetica, Arial;
text-decoration: none;
}
.error {
color: #990000;
}
</style>
</head>
<body bgcolor=white><br>
<form name=me method=post action=index.php>
<?
if($password && $_SESSION[pcs]!=$password){
?>
<table class=text align=center border=0 width=300 cellspacing=0 cellpadding=5 style="border-width:1px;border-style:solid;border-color:#00CCFF;">
<tr>
<td align=right style="background-color:#00CCFF;" class=navi><b>PHPCounterSmart LOGIN</b></td>
</tr>
<tr>
<td align=center><?=$error?><input type='password' name='password' style="width:49%;" maxlength=20> <input type=submit name=login value=login style="width:49%;"></td>
</tr>
</table>
<?}else{
$page = $_REQUEST[page];
if(!$page) $page=0;
$typ = $_REQUEST[typ];
if($typ!="tag" && $typ!= "monat" && $typ!="jahr") $typ="tag";
mysql_connect($dbhost, $dbuser, $dbpass) or die("NO CONNECTION TO DB-HOST");
mysql_select_db($dbname) or die("CANT OPEN DB");
function delete_old($tab, $max){
$sql = "select max(id) as x from $tab";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$anzahl = $rs->x;
}
mysql_free_result($abfrage);
$sql = "delete from $tab where id<".($anzahl-$max);
mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
}
function get_prozent($zahl, $max){
$prozent = 0;
if($zahl>0){
$prozent = number_format(round((100/$max)*$zahl,2),2);
}
return $prozent;
}
delete_old("phpcountersmart_referer",250);
delete_old("phpcountersmart_browser",800);
delete_old("phpcountersmart_os",300);
//delete_old("phpcountersmart_ip",20);
delete_old("phpcountersmart_screen",300);
delete_old("phpcountersmart_color",300);
delete_old("phpcountersmart_provider",250);
//BESUCHER GESAMT:
$sql = "select sum(tag) as x from phpcountersmart_besucher";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$besucher_gesamt = $rs->x;
}
mysql_free_result($abfrage);
if($typ=="tag"){
//BESUCHER TAGE:
$besucherarray = array();
$i=0;
$sql = "select tag, datum from phpcountersmart_besucher order by id desc limit ".($page*20).",20";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$besucherarray[$i][datum] = $rs->datum;
$besucherarray[$i][besucher] = $rs->tag;
if($rs->tag>$maxperiod) $maxperiod = $rs->tag;
$i++;
}
mysql_free_result($abfrage);
$sql = "select count(id) as anzahl from phpcountersmart_besucher";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$anzahl_besucher_gesamt = $rs->anzahl;
}
mysql_free_result($abfrage);
}else{
//BESUCHER MONATE ODER JAHRE:
if($typ=="monat"){
$sql = "select sum(tag) as summe, substring(datum,4,7) as dat
from phpcountersmart_besucher group by dat
order by
substring(datum,7,4) desc,
substring(datum,4,2) desc limit ".($page*20).",20";
$sql1 = "select substring(datum,4,7) as dat from phpcountersmart_besucher group by dat ";
}
if($typ=="jahr"){
$sql = "select sum(tag) as summe, substring(datum,7,4) as dat
from phpcountersmart_besucher group by dat
order by
substring(datum,7,4) desc limit ".($page*20).",20";
$sql1="select substring(datum,7,4) as dat from phpcountersmart_besucher group by dat";
}
$besucherarray = array();
$i=0;
;
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$besucherarray[$i][datum] = $rs->dat;
$besucherarray[$i][besucher] = $rs->summe;
if($rs->summe>$maxperiod) $maxperiod = $rs->summe;
$i++;
}
mysql_free_result($abfrage);
$abfrage = mysql_query($sql1) or die("SQL ERROR:<hr>".$sql1);
while($rs = mysql_fetch_object($abfrage)) {
$anzahl_besucher_gesamt+= 1;
}
mysql_free_result($abfrage);
}
//REFER GESAMT:
$refererarray = array();
$i=0;
$sql = "select woher, count(id) as anzahl from phpcountersmart_referer group by woher order by anzahl desc";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
if(eregi("http://",$rs->woher) && strlen($rs->woher)<160){
$refererarray[$i][anzahl] = $rs->anzahl;
$refererarray[$i][woher] = $rs->woher;
$i++;
}
}
mysql_free_result($abfrage);
//BROWSER GESAMT:
$browserarray = array();
$i= 0;
$browser_gesamt= 0;
$sql = "select typ, count(id) as anzahl from phpcountersmart_browser group by typ order by anzahl desc";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$browserarray[$i][anzahl] = $rs->anzahl;
$browserarray[$i][browser] = $rs->typ;
$browser_gesamt+= $rs->anzahl;
$i++;
}
mysql_free_result($abfrage);
if($whois){
//PROVIDER GESAMT:
$providerarray = array();
$i= 0;
$provider_gesamt= 0;
$sql = "select provider, count(id) as anzahl from phpcountersmart_provider group by provider order by anzahl desc";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$providerarray[$i][anzahl] = $rs->anzahl;
$providerarray[$i][provider] = $rs->provider;
$provider_gesamt+= $rs->anzahl;
$i++;
}
mysql_free_result($abfrage);
}
//OS GESAMT:
$osrarray = array();
$i= 0;
$os_gesamt= 0;
$sql = "select typ, count(id) as anzahl from phpcountersmart_os group by typ order by anzahl desc";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$osrarray[$i][anzahl] = $rs->anzahl;
$osrarray[$i][os] = $rs->typ;
$os_gesamt+= $rs->anzahl;
$i++;
}
mysql_free_result($abfrage);
//IP LETZTEN 20:
$iparray = array();
$i= 0;
$sql = "select zeit, adresse from phpcountersmart_ip order by zeit desc limit 20";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$iparray[$i][datum] = date("d.m.Y H:i:s",$rs->zeit);
$iparray[$i][ip] = $rs->adresse;
$i++;
}
mysql_free_result($abfrage);
//BESUCHER HEUTE:
$sql = "select tag from phpcountersmart_besucher order by id desc limit 1";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$heute = $rs->tag;
}
mysql_free_result($abfrage);
//TOP:
$toparray = array();
$i= 0;
$sql = "select tag, datum from phpcountersmart_besucher order by tag desc limit 10";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$toparray[$i][datum]=$rs->datum;
$toparray[$i][anzahl]=$rs->tag;
$i++;
}
mysql_free_result($abfrage);
//COLOR GESAMT:
$colorrarray = array();
$i= 0;
$color_gesamt= 0;
$sql = "select tiefe, count(id) as anzahl from phpcountersmart_color group by tiefe order by anzahl desc";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$colorrarray[$i][anzahl] = $rs->anzahl;
$colorrarray[$i][tiefe] = $rs->tiefe;
$color_gesamt+= $rs->anzahl;
$i++;
}
mysql_free_result($abfrage);
//SCREEN GESAMT:
$screenrarray = array();
$i= 0;
$screen_gesamt= 0;
$sql = "select aufloesung, count(id) as anzahl from phpcountersmart_screen group by aufloesung order by anzahl desc";
$abfrage = mysql_query($sql) or die("SQL ERROR:<hr>".$sql);
while($rs = mysql_fetch_object($abfrage)) {
$screenrarray[$i][anzahl] = $rs->anzahl;
$screenrarray[$i][aufloesung] = $rs->aufloesung;
$screen_gesamt+= $rs->anzahl;
$i++;
}
mysql_free_result($abfrage);
mysql_close();
$jetzt.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td colspan=2 align=left class=textfett height=20><span class=error>$t_counter</span></td></tr>
<tr><td width=75 align=right>".(number_format($besucher_gesamt))."</td><td align=right>$t_visits_all</td></tr>
<tr><td width=75 align=right><b>".(number_format($heute))."</b></td><td align=right>$t_visits_today</td></tr>
</table><img src='images/invisible.gif' width=5 height=5><br>";
$i=0;
$besucherarraygrafik = array_reverse($besucherarray);
foreach($besucherarraygrafik as $tmp){
switch ($typ){
case "tag":
$dat = substr($tmp[datum],0,5);
$s1 = "selected";
break;
case "monat":
$dat = substr($tmp[datum],0,2).".".substr($tmp[datum],5,2);
$s2 = "selected";
break;
case "jahr":
$dat = $tmp[datum];
$s3 = "selected";
break;
}
$height= get_prozent($tmp[besucher],$maxperiod)*2;
$oben.="<td valign=bottom align=center><img src=images/pixel.gif height=$height width=40></td>";
$unten.="<td align=center>$dat</td>";
$i++;
}
$select = "
<select name=typ onchange='document.me.submit();' style='width:20%;'>
<option value='tag' $s1>$t_day</option>
<option value='monat' $s2>$t_month</option>
<option value='jahr' $s3>$t_year</option>
</select>
";
$periodengrafik="
<table border=0 width=100% align=center cellspacing=1 class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><tr><td colspan=$i align=left>
$select
$t_periods_grafic</td></tr>
<tr>$oben</tr>
<tr>$unten</tr>
</table><img src='images/invisible.gif' width=5 height=5><br>
";
$perioden.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td colspan=2 align=left class=textfett height=20>$t_last_periods</td></tr>";
if($anzahl_besucher_gesamt/20>$page+1) $zx = "<a href=index.php?typ=$typ&page=".($page+1).">$t_back</a> ";
if($page>0) $wx = "<a href=index.php?typ=$typ&page=".($page-1).">$t_next</a> ";
$perioden.="<tr><td colspan=2 align=center >$zx $wx</td>";
foreach($besucherarray as $tmp){
$perioden.="<tr><td align=right width=75>$tmp[datum]</td><td align=right>".(number_format($tmp[besucher]))." $t_visitors</td></tr>";
}
$perioden.="</table><img src='images/invisible.gif' width=5 height=5><br>";
$i=0;
$top.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td colspan=2 align=left class=textfett height=20> $t_top10</td></tr>";
foreach($toparray as $tmp){
$i++;
$top.="<tr><td align=center width=150>DAMA $i. $tmp[datum]</td><td align=right>".(number_format($tmp[anzahl]))." $t_visitors</td></tr>";
}
$top.="</table><img src='images/invisible.gif' width=5 height=5><br>";
$browser.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td colspan=2 align=left class=textfett height=20>$t_browser</td></tr>";
foreach($browserarray as $tmp){
$browser.="<tr><td align=right width=75>".get_prozent($tmp[anzahl],$browser_gesamt)."%</td><td align=right>$tmp[browser]</td></tr>";
}
$browser.="</table><img src='images/invisible.gif' width=5 height=5><br>";
$os.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td colspan=2 align=left class=textfett height=20>$t_os</td></tr>";
foreach($osrarray as $tmp){
$os.="<tr><td align=right width=75>".get_prozent($tmp[anzahl],$os_gesamt)."%</td><td align=right>$tmp[os]</td></tr>";
}
$os.="</table><img src='images/invisible.gif' width=5 height=5><br>";
$color.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td colspan=2 align=left class=textfett height=20>$t_color_depth</td></tr>";
foreach($colorrarray as $tmp){
$color.="<tr><td align=right width=75>".get_prozent($tmp[anzahl],$color_gesamt)."%</td><td align=right>$tmp[tiefe]</td></tr>";
}
$color.="</table><img src='images/invisible.gif' width=5 height=5><br>";
$screen.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td colspan=2 align=left class=textfett height=20 >$t_screen</td></tr>";
foreach($screenrarray as $tmp){
$screen.="<tr><td align=right width=75>".get_prozent($tmp[anzahl],$screen_gesamt)."%</td><td align=right>$tmp[aufloesung] $t_pixel</td></tr>";
}
$screen.="</table><img src='images/invisible.gif' width=5 height=5><br>";
$ips.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td align=left class=textfett height=20>$t_last_ips</td></tr>";
foreach($iparray as $tmp){
$ips.="<tr><td align=left>$tmp[datum] $tmp[ip]</td></tr>";
}
$ips.="</table><img src='images/invisible.gif' width=5 height=5><br>";
$referer.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td colspan=2 align=left class=textfett height=20>$t_referer</td></tr>";
foreach($refererarray as $tmp){
$referer.="<tr><td width=20 align=right>$tmp[anzahl]</td><td><a href='$tmp[woher]' target=_blank><span class=text>$tmp[woher]</a></a></td></tr>";
}
$referer.="</table><img src='images/invisible.gif' width=5 height=5><br>";
if($whois){
$provider.="<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td colspan=2 align=left class=textfett height=20>$t_provider</td></tr>";
foreach($providerarray as $tmp){
$provider.="<tr><td width=20 align=right>$tmp[anzahl]</td><td>$tmp[provider]</a></td></tr>";
}
$provider.="</table><img src='images/invisible.gif' width=5 height=5><br>";
}
if($check_updates){
$updates="
<table border=0 width=100% align=center class=text style='border-width:1px;border-style:dashed;border-color:#00CCFF;'><tr bgcolor=\"#eeEEFF\"><td align=left class=textfett height=20>UPDATES</td></tr>
<tr><td width=20 align=right>
<iframe width='100%' height='100' src='http://www.powerweb99.at/phpcountersmart_updates.php?version=$version' scrolling='yes' frameborder=0></iframe>
</td></tr>
</table>";
}
?>
<table align=center width=950 cellspacing=0 cellpadding=3 border=0 width="980" align=center style="border-width:1px;border-style:solid;border-color:#00CCFF;">
<tr><td colspan=3 align=right style="background-color:#00CCFF;" class=navi height=20 valign=absmiddle> PHPCounterSmart <?=$version?> <?=$website?>
<?if($password){?>
| <a href='index.php?logout=true'><span class=error>EXIT</span></a></td></tr>
<?}?>
<tr>
<td colspan=3>
<?echo($periodengrafik);?>
</td>
</tr>
<tr>
<td valign=top width=33% align=left>
<?
echo($jetzt);
echo($perioden);
echo($top);
?>
<td valign=top width=34% align=center>
<?
echo($color);
echo($browser);
echo($screen);
echo($os);
?>
</td>
</td>
<td valign=top width=33% align=right>
<?
echo($ips);
?>
</td>
</tr>
<tr>
<td colspan=3>
<?echo($referer);?>
<?echo($provider);?>
<?echo($updates);?>
</td>
</tr>
</table>
<?}?>
<br>
<center>
<span class='small'>phpcountersmart © by <a href='http://www.powerweb99.at' target='_blank'>www.powerweb99.at</a></span>
</center>
</form>
</body></html>
|