errata_en.txt

Transcription

errata_en.txt
Page 212, Listing index.php
There is:
// Wenn Daten aus dem Eingabeformular (neu) gesendet wurden
if (!empty($fn_save)) {
save_new();
}
Must be:
// Wenn Daten aus dem Eingabeformular (neu) gesendet wurden
if (!empty($fn_save)) {
// Prüfen, ob nicht Seite aktualisiert
// wurde mit z.B. F5. der gleiche
// Eintrag soll nicht mehrmals
// gespeichert werden können
$sql_check = "SELECT * FROM $tblname ";
$sql_check .= "WHERE (what = '$fn_what' ";
$sql_check .= "AND url = '$fn_url')";
$result_check = mysql_query($sql_check);
$rows = mysql_num_rows($result_check);
if ($rows == 0) {
save_new();
}
}
Page 214, Listing index.php
There is:
// Wenn Daten aus dem Eingabeformular (neu) gesendet wurden
if (!empty($fn_save)) {
// Prüfen, ob nicht Seite aktualisiert
// wurde mit z.B. F5. der gleiche
// Eintrag soll nicht mehrmals
// gespeichert werden können
$sql_check = "SELECT * FROM $tblname ";
$sql_check .= "WHERE (what = '$fn_what' ";
$sql_check .= "AND url = '$fn_url')";
$result_check = mysql_query($sql_check);
$rows = mysql_num_rows($result_check);
if ($rows == 0) {
save_new();
}
}
Must be:
// Wenn Aufforderung für neuen Eintrag kommt
if (!empty($new)) {
// Formular für Neueingabe aufbauen
form_new();
}
Page 376
In Listing 5.39 it must be PRIMARY KEY (login_time) and not (period_of_time).
Page 439
The field 'refer' in the SQL is not necessary because the result is always the server the application is installed
on.
This is also the reason to erase the entry 'localhost' in the sample recordset.
Page 440
The path is:
php_steps\statistic\step_04\language.sql
Page 441
The path is:
php_steps\statistic\step_04\countries.sql
Page 467
The listing to show month and day of month is:
<TR>
<?php
//month and day of month
//Monats- und Monatstaganzeige
for ($i=0; $i < 10; $i++) {
if ( $HTTP_GET_VARS[lang] == "de" ) {
$month = date(j, $Last_10_days) . "." . get_ServerMonth_de();
} else {
$month = date("M j", $Last_10_days);
}
?>
<TD CLASS="std-small"
ALIGN="center"><?php echo $month;?></TD>
<?php
$Last_10_days = $Last_10_days + 86400;
}
?>
<TR>
Page 469
The listing to get the visits sorted by hour is (beginning at row $hour_actually = ...):
$hour_actually = date(G, $total_end_time);
// count hits
// Zaehle Treffer
$overall_h = mysql_num_rows($Select_database);
$t_hour = $hour_actually + 1;
// result is midnight
// Wenn das Ergebnis 24 Uhr ist
if ($t_hour == 24) {
$t_hour = 0;
}
?>
Page 470
The array $overall[count] is replaced in row 2 and 6 by $overall_h
Page 471
The array $overall[count] is replaced in row 7 by $overall_h
Page 476
This listing gets the hits for a path. After this the loaded pages are counted.
// get the highest score of a path
// Ermitteln der hoechsten Trefferzahl eines Pfades
$query_score = "SELECT hit FROM $tbl_path ORDER BY hit DESC";
$result_score = mysql_query($query_score) or die($stats_select . $tbl_path . $stats_result);
$datascore = mysql_fetch_array($result_score);
$highscore = $datascore[hit];
// get the loaded pages
// Ermitteln der genutzten/geladenen Seiten
$query = "SELECT path, hit FROM $tbl_path ORDER BY hit DESC";
$result = mysql_query($query) or die($stats_select . $tbl_path . $stats_result);
$number = mysql_num_rows($result);
if ($number > 0 ) {
$i=0;
for($i=0; $i<$number; $i++) {
$data=mysql_fetch_array($result);
$name = $data[path];
$bar_size_percent = substr(100 * $data[hit] / $highscore, 0, 5);
$bar_size = 250 * $bar_size_percent / 100;
Page 487
This listing provides a new window:
// get RIPE
// Wenn User ueber RIPE ...
echo ("<A HREF=\"javascript:new_browser('".$cmd.$ip."&submit=Anfrage+senden')\">more...</A></TD>");
// get INTERNIC
// Wenn User ueber INTERNIC ...
echo ("<A HREF=\"javascript:new_browser('".$cmd.$ip."&type=nameserver')\">more...</A></TD>");
// get ARIN
// Wenn User ueber ARIN ...
echo ("<A HREF=\"javascript:new_browser('".$cmd.$ip."')\">more...</A></TD>");
// if nothing fits get APNIC
// Im Zweifelsfall bei APNIC ...
echo ("<A HREF=\"javascript:new_browser('".$cmd.$ip."')\">more...</A></TD>");
Page 490
The rows $server=... and $domain=... are to be erased.
$host_adress is to be replaced by $host.
Before getting the value for $lang execute the following lines:
if ( empty($host)) {
$host = $ip;
}
$lang gets its value now in a different way:
$lang=substr(getenv('HTTP_ACCEPT_LANGUAGE'),0,5);
if (substr($lang,1,1)!="-" || substr($lang,2,1)!="-")
{
$lang = substr($lang,0,2);
}
The following code is also updated:
// analyse the domain o get the ending
// Zerlege die domain so, dass nur die Endung nach dem letzten Punkt
// uebrig bleibt
if ($host == "localhost") {
$country="other";
} else {
$country=substr(strrchr($host,"."),1);
}
Page 495
The row $domain_server = ... is to be erased.
To update the table countersys and to insert a recordset into table stats looks now like this:
// check is OS is already in DB
// Pruefe, ob OS schon auf der Datenbank oder neu ist
$Select_os = "SELECT type FROM $tbl_countersys WHERE (var = '$os')";
$result_os = mysql_query($Select_os) or die($stats_select . $tbl_countersys . $stats_result);
$number_os = mysql_num_rows($result_os);
if ($number_os > 0) {
// update table countersys
// Updaten von countersys
$os_upd = "UPDATE $tbl_countersys ";
$os_upd .= "SET count=count+1 ";
$os_upd .= "WHERE (var='$os' AND type='os')";
mysql_query($os_upd) or die($stats_update . $tbl_countersys . $stats_result);
} else {
// insert new OS into table countersys
// Einfuegen eines neuen OS in countersys
$os_upd_other = "UPDATE $tbl_countersys ";
$os_upd_other .= "SET count=count+1 ";
$os_upd_other .= "WHERE (var='Other' AND type='os')";
mysql_query($os_upd_other) or die($stats_update . $tbl_countersys . $stats_result);
}
// check if browser is already in db
// Pruefe, ob Browser schon auf der Datenbank oder neu ist
$Select_browser = "SELECT type FROM $tbl_countersys WHERE (var = '$browser')";
$result_browser = mysql_query($Select_browser) or die($stats_select . $tbl_countersys . $stats_result);
$number_browser = mysql_num_rows($result_browser);
if ($number_browser > 0) {
// update table countersys
// Updaten von countersys
$browser_upd = "UPDATE $tbl_countersys ";
$browser_upd .= "SET count=count+1 ";
$browser_upd .= "WHERE (var='$browser' AND type='browser')";
mysql_query($browser_upd) or die($stats_update . $tbl_countersys . $stats_result);
} else {
// insert new browser into table countersys
// Einfuegen eines neuen Browser in countersys
$browser_upd_other = "UPDATE $tbl_countersys ";
$browser_upd_other .= "SET count=count+1 ";
$browser_upd_other .= "WHERE (var='Other' AND type='browser')";
mysql_query($browser_upd_other) or die($stats_update . $tbl_countersys . $stats_result);
}
// update table countersys
// Updaten von countersys
$count_upd = "UPDATE $tbl_countersys ";
$count_upd .= "SET count=count+1 ";
$count_upd .= "WHERE (type='total' AND var='hits')";
mysql_query($count_upd) or die($stats_update . $tbl_countersys . $stats_result);
$received = getdate();
// insert data into table stats
// In Tabelle stats einfuegen
$count_insert = "INSERT INTO $tbl_stats ";
$count_insert .= "(id, ip, ";
$count_insert .= "received, os, ";
$count_insert .= "browser, lang, host) ";
$count_insert .= "values(0000, '$ip', $received[0], ";
$count_insert .= "'$os', '$browser', '$lang', '$host')";
mysql_query($count_insert) or die($stats_insert . $tbl_stats . $stats_result);
Page 502
The value must be 3599 instead of 3559:
// calculate the time to get xx:59:59
// Berechne die Zeit, dass sich der Wert xx:59:59 ergibt
$end_hour = $full_hour + 3599;

Documents pareils