Hallo @ All,
ich verwende einen B4Y Counter,jetzt möchte ich aber das der counter nicht so wie ursprünglich in einer Tabelle vertikal dargestellt wird sondern horizontal enweder mit tabelle oder ohne zum einbinden in einen footer.
Hier der quellcode:
PHP
<?php
########################################################################
## ##
## Name: B4YCounter v2.2 ##
## Kurzbeschreibung: einfacher Counter mir statistischer Anzeige ##
## Datum : 21.02.2004 ##
## Info: [url]www.board4you.at.tt[/url] ##
## [url]www.hoerandl.com/board/index.php[/url] ##
## E-Mail: [email]b4ycounter@hoerandl.com[/email] ##
## ##
########################################################################
## Konfigurationseinstellungen laden
if(!isset($db_table)) { include("config.inc.php"); }
## Variable erstellen
if ( isset($_SERVER['REMOTE_ADDR'])) { $addr = ($_SERVER['REMOTE_ADDR' ]); } else { $addr = ""; }
if ( isset($_SERVER['HTTP_USER_AGENT'])) { $user_agent = ($_SERVER['HTTP_USER_AGENT' ]); } else { $user_agent = ""; }
if ( isset($_SERVER['HTTP_REFERER'])) { $referer = ($_SERVER['HTTP_REFERER' ]); } else { $referer = ""; }
## aktuelle Zeit ermitteln
$zeit = time();
## IP-Lock von Minuten in Sekunden umwandeln
$ip_lock = $ip_lock*10;
## Verbindung mit der Datenbank herstellen
mysql_connect($db_server,$db_user,$db_pass) or die ("Konnte keine Verbindung zur Datenbank aufbauen");
mysql_select_db($db_name) or die("Konnte Datenbank nicht selektieren");
## verfallene Daten loeschen
mysql_query("DELETE FROM ".$db_table."counter_data WHERE time<='".($zeit-172800)."'");
mysql_query("DELETE FROM ".$db_table."counter_data WHERE time>'".($zeit+100)."'");
mysql_query("DELETE FROM ".$db_table."counter_data WHERE ip=''");
## wird eine IP übermittelt?
if(ereg ("(^[0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}$)",$addr)){
## IP HEUTE schonmal da gewesen?
## $ip_check1 = mysql_num_rows(mysql_query("SELECT id FROM ".$db_table."counter_data WHERE ip='$addr' && date='".date("Y-m-d", $zeit )."'"));
## IP in den letzten X Minuten schon mal dagewesen?
$ip_check = mysql_num_rows(mysql_query("SELECT id FROM ".$db_table."counter_data WHERE ip='$addr' && time>'".($zeit-$ip_lock)."' && date='".date("Y-m-d", $zeit )."'"));
} else { $ip_check=9; }
## schreibe wenn ip noch nicht vorhanden ist
if($ip_check==0) {
## schreibe neuen Counterstand
$counterstand_old = mysql_result(mysql_query("SELECT visits_all FROM ".$db_table."counter_max"),0,0);
mysql_query("UPDATE ".$db_table."counter_max SET visits_all='".($counterstand_old+1)."'");
## schreibe neue User Daten
mysql_query("INSERT INTO ".$db_table."counter_data (id, ip, time, date, client, host, referer)
VALUES ('',
'$addr',
'$zeit',
'".date("Y-m-d",$zeit)."',
'".$user_agent."',
'".gethostbyaddr($addr)."',
'$referer') ");
## max visits check
$max_visits_new = mysql_num_rows(mysql_query("SELECT date FROM ".$db_table."counter_data WHERE date='".date("Y-m-d",$zeit)."'"));
$max_visits_old = mysql_result(mysql_query("SELECT visits FROM ".$db_table."counter_max"),0,0);
if($max_visits_new > $max_visits_old){mysql_query("UPDATE ".$db_table."counter_max SET visits='$max_visits_new'");}
## max user online check
$max_user_new = mysql_num_rows(mysql_query("SELECT date FROM ".$db_table."counter_data WHERE time>'".(time()-$verfall)."'"));
$max_user_old = mysql_result(mysql_query("SELECT user FROM ".$db_table."counter_max"),0,0);
if($max_user_new > $max_user_old){mysql_query("UPDATE ".$db_table."counter_max SET user='$max_user_new'");}
} else {
## Update der vorhandenen Daten
mysql_query("UPDATE ".$db_table."counter_data SET time='$zeit', date='".date("Y-m-d", $zeit)."' WHERE ip='$addr' && time>'".($zeit-$ip_lock)."' && date='".date("Y-m-d", $zeit )."'"); }
## Einträge in für die Counterstatistik
$date=date("Y-m-d",$zeit);
$visits = mysql_num_rows(mysql_query("SELECT id FROM ".$db_table."counter_data WHERE date='".date("Y-m-d",$zeit)."'"));
$query = "SELECT * FROM ".$db_table."counter_stat WHERE date='$date' limit 0,1";
$result = mysql_query($query) or die (mysql_error());
$gesX = mysql_num_rows($result);
while ($daten = mysql_fetch_array($result)) {$count=$daten['count'];}
if ($gesX=="0") {
mysql_query("INSERT INTO ".$db_table."counter_stat (date, count) VALUES ('$date','$visits') ");
} else {
mysql_query("UPDATE ".$db_table."counter_stat SET count='$visits' WHERE date='$date'");
}
## Auslesen der Config-Daten
$query = "SELECT * from ".$db_table."counter_config";
$result = mysql_query($query) or die (mysql_error());
while ($daten = mysql_fetch_array($result)) {
$show_lastday = $daten['lastday'];
$show_visits = $daten['visits'];
$show_user_online = $daten['user_online'];
$show_max_user = $daten['max_user_online'];
$show_max_visits = $daten['max_visits'];
$show_visits_all = $daten['visits_all'];
$show_statistiklink = $daten['statistiklink'];
$show_stat_year = $daten['stat_year'];
$show_stat_month = $daten['stat_month'];
$show_stat_day = $daten['stat_day'];
$page_back_color = $daten['page_back_color'];
$table_back_color = $daten['table_back_color'];
$table_head_color = $daten['table_head_color'];
$table_lines_1 = $daten['table_lines_1'];
$table_lines_2 = $daten['table_lines_2'];
$text_color_1 = $daten['text_color_1'];
$text_color_2 = $daten['text_color_2'];
$link_color = $daten['link_color'];
$visited_link = $daten['visited_link'];
$active_links = $daten['active_link'];
$hover_links = $daten['hover_link'];
$balken_color = $daten['balken_color'];
$url = $daten['url'];
}
## Ausgabe der Daten
$max_visits = mysql_result(mysql_query(" SELECT visits FROM ".$db_table."counter_max"),0,0);
$max_user = mysql_result(mysql_query(" SELECT user FROM ".$db_table."counter_max"),0,0);
$user_online = mysql_num_rows(mysql_query("SELECT id FROM ".$db_table."counter_data WHERE time>'".($zeit-$verfall)."' group by ip "));
$lastday = mysql_num_rows(mysql_query("SELECT id FROM ".$db_table."counter_data WHERE date='".date("Y-m-d", $zeit-86400)."'"));
$visits = mysql_num_rows(mysql_query("SELECT id FROM ".$db_table."counter_data WHERE date='".date("Y-m-d",$zeit)."'"));
$visits_all = mysql_result(mysql_query(" SELECT visits_all FROM ".$db_table."counter_max"),0,0);
echo"<STYLE TYPE=\"text/css\">";
echo"<!--";
echo"a:link {Color: ".$link_color. "; TEXT-DECORATION: none;}";
echo"a:visited {Color: ".$visited_link. "; TEXT-DECORATION: none;}";
echo"a:active {Color: ".$activ_links. "; TEXT-DECORATION: none;}";
echo"a:hover {Color: ".$hover_links. "; TEXT-DECORATION: none;}";
echo"-->";
echo"</STYLE>";
echo"<body bgcolor=\"".$page_back_color."\">";
echo"<table width=\"140\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" bgcolor=\"".$table_back_color."\">";
echo"<tr>";
echo"<td height=\"10\" bgcolor=\"".$table_head_color."\"><font color=\"".$text_color_1."\" size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">[b]RTV 1860 e.V.[/b]</font></td>";
echo"</tr>";
echo"<tr>";
echo"<td valign=\"top\"> ";
echo"<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">";
if ($show_lastday=="yes") {
echo"<tr bgcolor=\"".$table_lines_2."\">";
echo"<td width=\"110\"><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Visits Gestern: </font></td>";
echo"<td>";
echo"<div align=\"right\"><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">[b]".$lastday."[/b]</font></div>";
echo"</td>";
echo"</tr>";
}
if ($show_visits=="yes") {
echo"<tr bgcolor=\"".$table_lines_2."\">";
echo"<td><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Visits Heute: </font></td>";
echo"<td>";
echo"<div align=\"right\"><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">[b]".$visits."[/b]</font></div>";
echo"</td>";
echo"</tr>";
}
if ($show_user_online=="yes") {
echo"<tr bgcolor=\"".$table_lines_2."\">";
echo"<td><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">User Online: </font></td>";
echo"<td>";
echo"<div align=\"right\"><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">[b]".$user_online."[/b]</font></div>";
echo"</td>";
echo"</tr>";
}
if ($show_max_user=="yes") {
echo"<tr bgcolor=\"".$table_lines_2."\">";
echo"<td><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Max User Online: </font></td>";
echo"<td>";
echo"<div align=\"right\"><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">[b]".$max_user."[/b]</font></div>";
echo"</td>";
echo"</tr>";
}
if ($show_max_visits=="yes") {
echo"<tr bgcolor=\"".$table_lines_2."\">";
echo"<td><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Max Visits/Day: </font></td>";
echo"<td>";
echo"<div align=\"right\"><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">[b]".$max_visits."[/b]</font></div>";
echo"</td>";
echo"</tr>";
}
if ($show_visits_all=="yes") {
echo"<tr bgcolor=\"".$table_lines_2."\">";
echo"<td><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">Counter Full: </font></td>";
echo"<td>";
echo"<div align=\"right\"><font color=\"".$text_color_2."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">[b]".$visits_all."[/b]</font></div>";
echo"</td>";
echo"</tr>";
}
echo"</table>";
if ($show_statistiklink=="yes") {
echo"<div align=\"center\"><font color=\"".$text_color_1."\" size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">[b]<a href=\"".$url."\statistik.php\" target=\"Hauptframe\">...::: STATISTIK :::...</a>[/b]</font></div>";
}
echo"</td>";
echo"</tr>";
echo"</table>";
echo"</body>";
?>
Alles anzeigen
wenn mir da jemand helfen könnte das zu realisieren wäre echt super.
Im voraus schonmal dank
mfg
Nixchecker