"; $toc = array(); if (($handle = fopen("./book_index_" . $language . ".csv", 'r')) !== false) { while (($data = fgetcsv($handle, 0, ',')) !== false) { array_push($toc, $data); if ($data[2] > 0) { $bookid = $data[2]; $toc_book["$bookid"] = $data[1]; } } } echo "

"; echo $gui['word_analysis']; echo "

"; if (isset($_GET["spell"])) { $spell = $_GET["spell"]; } else { $spell = ""; } if (isset($_GET["wordop"])) { $wordop = $_GET["wordop"]; if (isset($_GET["spell"]) && $_GET["spell"] != "" && $wordop = "end") { $spell = "%" . $_GET["spell"]; $wordop = "like"; } else if (isset($_GET["spell"]) && $_GET["spell"] != "" && $wordop = "begin") { $spell = $_GET["spell"] . "%"; $wordop = "like"; } else { $spell = ""; } } else { $wordop = "="; } if (!isset($_GET["groupby"])) { ?>
/>


"; for ($x = 0; $x < $arrlength; $x++) { echo "
  • " . $toc[$x][1] . "
  • "; } echo ""; ?>
    " . $gui['home'] . "
    "; echo $gui['your_choice'] . ":
    "; $boolList = array(); for ($i = 1; $i < 218; $i++) { if (isset($_GET["$i"])) { if ($_GET["$i"] == "on") { array_push($boolList, "$i"); echo $toc_book["$i"] . "; "; } } } echo "
    "; $countInsert = 0; $wordlist = array(); $db_file = _FILE_DB_STATISTICS_; $bookstring = ""; for ($i = 0; $i < count($boolList); $i++) { $bookstring .= "'" . $boolList[$i] . "'"; if ($i < count($boolList) - 1) { $bookstring .= ","; } } //open database PDO_Connect(_FILE_DB_STATISTICS_,_DB_USERNAME_,_DB_PASSWORD_); if ($spell == "") { echo ("

    " . $gui['group_by'] . ":$groupby

    "); $query = "SELECT count(*) FROM "._TABLE_WORD_STATISTICS_." WHERE (bookid in (" . $bookstring . ")) "; /*查總數*/ $count_word = PDO_FetchOne($query); $query = "SELECT sum(count) FROM "._TABLE_WORD_STATISTICS_." WHERE (bookid in (" . $bookstring . ")) "; /*查總數,并分類匯總*/ $sum_word = PDO_FetchOne($query); $query = "SELECT count(*) from (SELECT count() FROM "._TABLE_WORD_STATISTICS_." WHERE (bookid in (" . $bookstring . ") and $groupby<>'') group by $groupby ) as subtable"; /*查總數,并分類匯總*/ $count_parent = PDO_FetchOne($query); $query = "SELECT sum(length) from (SELECT * FROM "._TABLE_WORD_STATISTICS_." WHERE (bookid in (" . $bookstring . ") and $groupby<>'') group by $groupby ) as subtable"; /*查總數,并分類匯總*/ $count_parent1 = PDO_FetchOne($query); $query = "SELECT sum(count) FROM "._TABLE_WORD_STATISTICS_." WHERE (bookid in (" . $bookstring . ") and $groupby<>'') "; /*查總數,并分類匯總*/ $sum_parent = PDO_FetchOne($query); $format = number_format($count_word); echo $gui['vacab'] . ":$format
    "; echo $gui['word_count'] . ":" . number_format($sum_word) . "
    "; echo "$groupby" . $gui['statistics'] . ":" . number_format($count_parent) . "
    "; echo "$groupby字母" . $gui['statistics'] . ":" . number_format($count_parent1) . "
    "; echo $gui['effective'] . ":" . number_format($sum_parent) . "
    "; $query = "SELECT * from (SELECT $groupby,sum(count) as wordsum FROM "._TABLE_WORD_STATISTICS_." WHERE (bookid in (" . $bookstring . ") and $groupby<>'') as T group by $groupby) as T order by wordsum DESC limit 4000"; /*查總數,并分類匯總*/ $Fetch = PDO_FetchAll($query); $iFetch = count($Fetch); echo ""; echo ""; $sum_prsent = 0; if ($iFetch > 0) { $sum = $Fetch[0]["wordsum"]; $first = $sum * 100 / $sum_word; for ($i = 0; $i < $iFetch; $i++) { $sum = $Fetch[$i]["wordsum"]; $prsent = $sum * 100 / $sum_word; $prsent1 = $prsent * 100 / $first; $sum_prsent += $prsent; echo ""; echo ""; echo ""; } } echo "
    " . $gui['serial_num'] . "$groupby" . $gui['count'] . "" . $gui['percentage'] . "" . $gui['accumulative'] . "
    " . ($i + 1) . "" . $Fetch[$i][$groupby] . "" . number_format($sum) . "" . number_format($prsent, 3) . "" . number_format($sum_prsent, 1) . "
    "; } else { echo ("

    Word: $spell

    "); $newSpell = $PDO->quote($spell); $query = "SELECT count(*) FROM "._TABLE_WORD_STATISTICS_." WHERE (word $wordop $newSpell) "; /*查總词數*/ $count_word = PDO_FetchOne($query); $query = "SELECT sum(count) FROM "._TABLE_WORD_STATISTICS_." WHERE (word $wordop $newSpell) "; /*查總數,并分類匯總*/ $sum_word = PDO_FetchOne($query); echo "单词总个数:" . number_format($count_word) . "
    "; echo "单词总数:" . number_format($sum_word) . "
    "; $query = "SELECT count(*) from (SELECT bookid FROM "._TABLE_WORD_STATISTICS_." WHERE (word $wordop $newSpell) group by bookid) as T "; /*查總數,并分類匯總*/ $in_book_count = PDO_FetchOne($query); echo "

    In $in_book_count Books

    "; $query = "SELECT bookid,co,su from (SELECT bookid,sum(count) as su,count(*) co FROM "._TABLE_WORD_STATISTICS_." WHERE (word $wordop $newSpell) group by bookid) as T order by co DESC limit 20"; /*查總數,并分類匯總*/ $Fetch = PDO_FetchAll($query); $iFetch = count($Fetch); echo ""; echo ""; if ($iFetch > 0) { for ($i = 0; $i < $iFetch; $i++) { echo ""; echo ""; echo ""; } } echo "
    序号Book单词个数单词数量
    " . ($i + 1) . "" . $toc_book[$Fetch[$i]["bookid"]] . "" . number_format($Fetch[$i]["co"]) . "" . number_format($Fetch[$i]["su"]) . "
    "; $query = "SELECT count(*) from (SELECT word FROM "._TABLE_WORD_STATISTICS_." WHERE (word $wordop $newSpell) group by word) as T "; /*查總數,并分類匯總*/ $word_count = PDO_FetchOne($query); echo "

    $word_count Words

    "; $query = "SELECT word,co from (SELECT word,sum(count) co FROM "._TABLE_WORD_STATISTICS_." WHERE (word $wordop $newSpell) group by word) as T order by co DESC limit 100"; /*查總數,并分類匯總*/ $Fetch = PDO_FetchAll($query); $iFetch = count($Fetch); echo ""; echo ""; if ($iFetch > 0) { for ($i = 0; $i < $iFetch; $i++) { echo ""; echo ""; echo ""; } } echo "
    序号Word数量
    " . ($i + 1) . "" . $Fetch[$i]["word"] . "" . number_format($Fetch[$i]["co"]) . "
    "; } /*查询结束*/ ?>