<?php
    include "db_connect.inc";

    $result = mysql_db_query($db_database,
                             "SELECT COUNT(*) FROM Authors",
                             $link);
    $row = mysql_fetch_array($result);
    $authors = $row[0];
    mysql_free_result($result);

    $result = mysql_db_query($db_database,
                             "SELECT COUNT(*) FROM Texts",
                             $link);
    $row = mysql_fetch_array($result);
    $texts = $row[0];
    mysql_free_result($result);

    $result = mysql_db_query($db_database,
                             "SELECT COUNT(*) FROM Comments",
                             $link);
    $row = mysql_fetch_array($result);
    $comments = $row[0];
    mysql_free_result($result);

    $result = mysql_db_query($db_database,
                             "SELECT SUM(Views) FROM Texts",
                             $link);
    $row = mysql_fetch_array($result);
    $views = $row[0];
    mysql_free_result($result);

    $result = mysql_db_query($db_database,
                             "SELECT COUNT(*) FROM Logins",
                             $link);
    $row = mysql_fetch_array($result);
    $logins = $row[0];
    mysql_free_result($result);

    $result = mysql_db_query($db_database,
                             "SELECT COUNT(*) FROM Marks",
                             $link);
    $row = mysql_fetch_array($result);
    $marks = $row[0];
    mysql_free_result($result);
?>

<CENTER>
<B>Статистика</B>
<TABLE BORDER=0 cellspacing=1 cellpadding=3 WIDTH="100%">
        <tr>
                <td BGCOLOR = "#CCCCCC">
                    <B>Авторов</B>
                </td>
                <td BGCOLOR = "#EEEEEE">
                        <?php print($authors); ?>
                </td>
        </tr>
        <tr>
                <td BGCOLOR = "#CCCCCC">
                    <B>Работ</B>
                </td>
                <td BGCOLOR = "#EEEEEE">
                        <?php print($texts); ?>
                </td>
        </tr>
        <tr>
                <td BGCOLOR = "#CCCCCC">
                    <B>Комментариев</B>
                </td>
                <td BGCOLOR = "#EEEEEE">
                        <?php print($comments); ?>
                </td>
        </tr>
        <tr>
                <td BGCOLOR = "#CCCCCC">
                        <B>Просмотров</B>
                </td>
                <td BGCOLOR = "#EEEEEE">
                        <?php print($views); ?>
                </td>
        </tr>
        <tr>
                <td BGCOLOR = "#CCCCCC">
                    <B>Оценок</B>
                </td>
                <td BGCOLOR = "#EEEEEE">
                        <?php print($marks); ?>
                </td>
        </tr>
        <tr>
                <td BGCOLOR = "#CCCCCC">
                    <B>Зарегистрированных<br>Пользователей</B>
                </td>
                <td BGCOLOR = "#EEEEEE">
                        <?php print($logins); ?>
                </td>
        </tr>
</TABLE>
</CENTER>
