home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.pdx.edu
/
2014.02.ftp.ee.pdx.edu.tar
/
ftp.ee.pdx.edu
/
oss
/
cvs-2004
/
bahasa
/
web
/
statistics.php,v
< prev
next >
Wrap
Text File
|
2003-10-20
|
15KB
|
701 lines
head 1.8;
access;
symbols
Initial:1.1.1.1 bule:1.1.1;
locks; strict;
comment @# @;
1.8
date 2003.10.20.00.21.46; author bule; state Exp;
branches;
next 1.7;
1.7
date 2003.10.18.00.33.42; author bule; state Exp;
branches;
next 1.6;
1.6
date 2003.10.06.00.39.27; author bule; state Exp;
branches;
next 1.5;
1.5
date 2003.10.01.06.51.30; author bule; state Exp;
branches;
next 1.4;
1.4
date 2003.09.11.05.28.22; author bule; state Exp;
branches;
next 1.3;
1.3
date 2003.09.04.07.27.00; author bule; state Exp;
branches;
next 1.2;
1.2
date 2003.08.19.19.24.21; author bule; state Exp;
branches;
next 1.1;
1.1
date 2003.08.12.19.18.23; author bule; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2003.08.12.19.18.23; author bule; state Exp;
branches;
next ;
desc
@@
1.8
log
@*** empty log message ***
@
text
@<?
session_start();
require_once("../php/Statistics.php");
require_once("../php/Web.php");
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Project Name: Bahasa Indonesia Dictionary
// Directory: bahasa/web
// File Name: statistics.php
// Author(s): John L. Whiteman
// Created: June 23, 2003
// Modified: October 19, 2003
// Description: The purpose of this restricted access PHP web
// client page is allow an administrator to view
// various statistics regarding the current state
// of a live project.
//
// Copyright (c) 2003 John L. Whiteman
//
// Permission is herby granted, free of charge, to any person obtaining a
// copy of this software, data, and associated documentation files
// (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHERE IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING IN THE SOFTWARE.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
$web = new Web();
if (!$_SESSION['ADMIN']) {
$web->redirect("login.php");
exit;
}
$statistics = new Statistics();
$status = $statistics->get_dictionary_status();
if ($status["status"] == 1 || $status["status"] == 2) {
$web->redirect("admin.php");
exit;
}
$title = "Statistics";
if (isset($_POST['database'])) {
$title .= " [Database]";
} else if (isset($_POST['dictionary'])) {
$title .= " [Dictionary]";
} else if (isset($_POST['php'])) {
$title .= " [PHP]";
} else if (isset($_POST['searches'])) {
$title .= " [Searches]";
} else if (isset($_POST['visitors'])) {
$title .= " [Visitors]";
}
?>
<html>
<head>
<title>Bahasa Indonesia Dictionary: <? echo "$title";?></title>
<link href="bahasa.css" rel="stylesheet" type="text/css">
</head>
<body>
<?
$web->show_logo("$title");
?>
<a href="admin.php">Administration</a>
<br>
<?
if (isset($_POST['database'])) {
view_database($web, $statistics);
} else if (isset($_POST['dictionary'])) {
view_dictionary($web, $statistics);
} else if (isset($_POST['php'])) {
view_php($statistics);
} else if (isset($_POST['searches'])) {
view_searches($web, $statistics);
} else if (isset($_POST['visitors'])) {
view_visitors($web, $statistics);
} else {
}
?>
</body>
</html>
<?
///////////////////////////////////////////////////////////////////////////////
function view_database($web, $statistics) {
$stats = array();
$errstr = $statistics->get_database_statistics($stats);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$client_info = $web->tohtml($stats["client_info"]);
$host_info = $web->tohtml($stats["host_info"]);
$proto_info = $web->tohtml($stats["proto_info"]);
$server_info = $web->tohtml($stats["server_info"]);
$database_name = $web->tohtml($stats["database_name"]);
$remote_adx = $web->tohtml($stats["remote_adx"]);
$tables = $stats["tables"];
$required_tables = $stats["required_tables"];
$tables_html =
"<table cellpadding=\"3\" cellspacing=\"3\" border=\"1\"><tr>\n" .
"<th>Table Name</th>\n" .
"<th>Total Entries</th>\n" .
"<th>SQL File</th>\n" .
"<th>Description</th></tr>\n";
foreach($tables as $table_name) {
$table_count = 0;
$errstr = $statistics->get_count($table_name, $table_count);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$table_name = $web->tohtml($table_name);
$sql_file =
$web->tohtml($required_tables[$table_name]['sql']);
$description =
$web->tohtml($required_tables[$table_name]['description']);
$tables_html .=
"<tr>\n" .
"<td>${table_name}</td>\n" .
"<td>${table_count}</td>\n" .
"<td>${sql_file}</td>\n" .
"<td>${description}</td>\n" .
"</tr>\n";
}
$tables_html .= "</table>\n";
print <<<EOFVDB
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td colspan="2"><hr><b>Database Server</b><hr></td>
</tr><tr>
<td>mySQL Host:</td>
<td>${host_info}</td>
</tr><tr>
<td>mySQL Server:</td>
<td>${server_info}</td>
</tr><tr>
<td>mySQL Client:</td>
<td>${client_info}</td>
</tr><tr>
<td>mySQL Proto:</td>
<td>${proto_info}</td>
</tr><tr>
<td>Database Name:</td>
<td>${database_name}</td>
</tr><tr>
<td>Remote Address:</td>
<td>${remote_adx}</td>
</tr><tr>
<td colspan="2"><hr><b>Database Tables</b><hr></td>
</tr>
</table>
$tables_html
EOFVDB;
}
///////////////////////////////////////////////////////////////////////////////
function view_dictionary($web, $statistics) {
$dictionary = array();
$errstr = $statistics->get_dictionary_statistics($dictionary);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$total = $web->tohtml($dictionary["total"]);
$total_pos = $web->tohtml($dictionary["total_pos"]);
$old_spelling = $web->tohtml($dictionary["old_spelling"]);
$new_spelling = $web->tohtml($dictionary["new_spelling"]);
$comments = $web->tohtml($dictionary["comments"]);
$parts_of_speech = $dictionary["parts_of_speech"];
$pos_html = "";
foreach($parts_of_speech as $pos => $count) {
$pos = ucfirst($pos);
$pos = $web->tohtml($pos);
$pos_html .=
"<tr><td> -${pos}</td>" .
"<td>${count}</td></tr>\n";
}
print <<<EOFVD
<table cellspacing="3" cellpadding="3" border="0">
<tr>
<td colspan="2"><hr><b>Entries</b><hr></td>
</tr><tr>
<td>Total:</td>
<td>${total}</td>
</tr><tr>
<td>Old Spelling:</td>
<td>${old_spelling}</td>
</tr><tr>
<td>New Spelling:</td>
<td>${new_spelling}</td>
</tr><tr>
<td>Comments:</td>
<td>${comments}</td>
</tr><tr>
<td colspan="2"><hr><b>Parts of Speech</b><hr></td>
</tr><tr>
<td>Categories:</td>
<td>${total_pos}</td>
</tr>
${pos_html}
</table>
EOFVD;
return;
}
///////////////////////////////////////////////////////////////////////////////
function view_php($statistics) {
print "<br><br>";
phpinfo();
return;
}
///////////////////////////////////////////////////////////////////////////////
function view_searches($web, $statistics) {
$searches = array();
$errstr = $statistics->get_searches_statistics($searches);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$total = $web->tohtml($searches["total"]);
$unique = $web->tohtml($searches["unique"]);
$average = $web->tohtml($searches["average"]);
$english = $web->tohtml($searches["english"]);
$indonesian = $web->tohtml($searches["indonesian"]);
$exact = $web->tohtml($searches["exact"]);
$fuzzy = $web->tohtml($searches["fuzzy"]);
$linear = $web->tohtml($searches["linear"]);
$hits = $web->tohtml($searches["hits"]);
$maybes = $web->tohtml($searches["maybes"]);
$misses = $web->tohtml($searches["misses"]);
$oldest = $web->tohtml($searches["oldest"]);
$newest = $web->tohtml($searches["newest"]);
$hit_rate = $web->tohtml($searches["hit_rate"]);
$maybe_rate = $web->tohtml($searches["maybe_rate"]);
$miss_rate = $web->tohtml($searches["miss_rate"]);
$coverage = $web->tohtml($searches["coverage"]);
$coverage_rate = $web->tohtml($searches["coverage_rate"]);
print <<<EOFVS
<table cellspacing="3" cellpadding="3" border="0">
<tr>
<td colspan="2"><hr><b>Visitors</b><hr></td>
</tr><tr>
<td>Total:</td>
<td>${total}</td>
</tr><tr>
<td>Unique:</td>
<td>${unique}</td>
</tr><tr>
<td>Average:</td>
<td>${average}</td>
</tr><tr>
<td>Oldest:</td>
<td>${oldest}</td>
</tr><tr>
<td>Newest:</td>
<td>${newest}</td>
</tr><tr>
<td colspan="2"><hr><b>Results</b><hr></td>
</tr><tr>
<td>Hits:</td>
<td>${hits}</td>
</tr><tr>
<td>Hit Rate:</td>
<td>${hit_rate}</td>
</tr><tr>
<td>Maybes:</td>
<td>${maybes}</td>
</tr><tr>
<td>Maybe Rate:</td>
<td>${maybe_rate}</td>
</tr><tr>
<td>Misses:</td>
<td>${misses}</td>
</tr><tr>
<td>Miss Rate:</td>
<td>${miss_rate}</td>
</tr><tr>
<td>Coverage:</td>
<td>${coverage}</td>
</tr><tr>
<td>Coverage Rate:</td>
<td>${coverage_rate}</td>
</tr><tr>
<td colspan="2"><hr><b>Language</b><hr></td>
</tr><tr>
<td>English:</td>
<td>${english}</td>
</tr><tr>
<td>Indonesian:</td>
<td>${indonesian}</td>
</tr><tr>
<td colspan="2"><hr><b>Search Type</b><hr></td>
</tr><tr>
<td>Exact:</td>
<td>${exact}</td>
</tr><tr>
<td>Fuzzy:</td>
<td>${fuzzy}</td>
</tr><tr>
<td>Linear:</td>
<td>${linear}</td>
</tr>
</table>
EOFVS;
return;
}
///////////////////////////////////////////////////////////////////////////////
function view_visitors($web, $statistics) {
$visitors = array();
$errstr = $statistics->get_searches_statistics($visitors);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$total = $web->tohtml($visitors["total"]);
$unique = $web->tohtml($visitors["unique"]);
$average = $web->tohtml($visitors["average"]);
$english = $web->tohtml($visitors["english"]);
$indonesian = $web->tohtml($visitors["indonesian"]);
$exact = $web->tohtml($visitors["exact"]);
$fuzzy = $web->tohtml($visitors["fuzzy"]);
$linear = $web->tohtml($visitors["linear"]);
$hits = $web->tohtml($visitors["hits"]);
$maybes = $web->tohtml($visitors["maybes"]);
$misses = $web->tohtml($visitors["misses"]);
$oldest = $web->tohtml($visitors["oldest"]);
$newest = $web->tohtml($visitors["newest"]);
$hit_rate = $web->tohtml($visitors["hit_rate"]);
$maybe_rate = $web->tohtml($visitors["maybe_rate"]);
$miss_rate = $web->tohtml($visitors["miss_rate"]);
$visits = $visitors["visitors"];
if ($total == 0) {
print "<hr><b>No dictionary searches found!</b><hr>\n";
return;
}
print
"<table cellpadding=\"3\" cellspacing=\"3\" border=\"0\">\n" .
"<tr>\n" .
"<td>Total:</td>\n" .
"<td><u>${total}</u> </td>\n" .
"<td>Unique:</td>\n" .
"<td><u>${unique}</u> </td>\n" .
"<td>Hit Rate:</td>\n" .
"<td><u>${hit_rate}</u> </td>\n" .
"<td>Maybe Rate:</td>\n" .
"<td><u>${maybe_rate}</u> </td>\n" .
"<td>Miss Rate:</td>\n" .
"<td><u>${miss_rate}</u> </td>\n" .
"<td>Average:</td>\n" .
"<td><u>${average}</u> </td>\n" .
"</tr></table><hr>\n";
$vhtml =
"<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">\n" .
"<tr>\n" .
"<th>PKEY</th>\n" .
"<th>Visitor</th>\n" .
"<th>Total</th>\n" .
"<th>Hit Rate</th>\n" .
"<th>Hits</th>\n" .
"<th>Maybes</th>\n" .
"<th>Misses</th>\n" .
"<th>English</th>\n" .
"<th>Indonesian</th>\n" .
"<th>Exact</th>\n" .
"<th>Fuzzy</th>\n" .
"<th>Linear</th>\n" .
"<th>Created</th>\n" .
"<th>Modified</th>\n" .
"</tr>\n";
foreach($visits as $visit) {
$vpkey = $web->tohtml($visit->pkey);
$vvisitor = $web->tohtml($visit->visitor);
$venglish = $web->tohtml($visit->english);
$vindonesian = $web->tohtml($visit->indonesian);
$vexact = $web->tohtml($visit->exact);
$vfuzzy = $web->tohtml($visit->fuzzy);
$vlinear = $web->tohtml($visit->linear);
$vhits = $web->tohtml($visit->hits);
$vmaybes = $web->tohtml($visit->maybes);
$vmisses = $web->tohtml($visit->misses);
$vtotal = $web->tohtml($visit->total);
$vcreated = $web->tohtml($visit->created);
$vmodified = $web->tohtml($visit->modified);
$vhit_rate = "0.00%";
$vcreated = $statistics->get_date($vcreated);
if ($vtotal > 0) {
$vhit_rate =
sprintf("%000.2f%%", 100 * ($vhits) / ($vtotal));
}
if ($vmodified > 0) {
$vmodified = $statistics->get_date($vmodified);
} else {
$vmodified = "N/A";
}
$vhtml .=
"<tr>\n" .
"<td>${vpkey} </td>\n" .
"<td>${vvisitor} </td>\n" .
"<td>${vtotal} </td>\n" .
"<td>${vhit_rate} </td>\n" .
"<td>${vhits} </td>\n" .
"<td>${vmaybes} </td>\n" .
"<td>${vmisses} </td>\n" .
"<td>${venglish} </td>\n" .
"<td>${vindonesian} </td>\n" .
"<td>${vexact} </td>\n" .
"<td>${vfuzzy} </td>\n" .
"<td>${vlinear} </td>\n" .
"<td>${vcreated} </td>\n" .
"<td>${vmodified} </td>\n " .
"</tr><tr>\n" .
"<td colspan=\"14\"><hr><td>\n" .
"</tr>\n";
}
$vhtml .= "</table>\n";
print "$vhtml";
return;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
?>
@
1.7
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 17, 2003
d85 3
@
1.6
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 05, 2003
d84 1
a84 3
<title>
Bahasa Indonesia Dictionary: <? echo "$title";?>
</title>
@
1.5
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 30, 2003
d89 3
a91 2
<h2>Bahasa Indonesia Dictionary: <? echo "$title";?> </h2>
@
1.4
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 05, 2003
d41 1
a41 1
if (!session_is_registered("ADMIN")) {
@
1.3
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 03, 2003
d92 1
a92 2
<br><br>
d421 7
@
1.2
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 19, 2003
@
1.1
log
@Initial revision
@
text
@d5 34
a38 1
a522 1
@
1.1.1.1
log
@Bahasa Indonesia Dictionary
@
text
@@