sma-website /search/stats.php

Language PHP Lines 186
MD5 Hash ba11eaee38a909df21ec258555529307 Estimated Cost $3,557 (why?)
Repository https://bitbucket.org/molusc/sma-website.git View Raw File
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php

/******************************************************************************
 * iSearch2 - website search engine                                           *
 *                                                                            *
 * Visit the iSearch homepage at http://www.iSearchTheNet.com/isearch         *
 *                                                                            *
 * Copyright (C) 2002-2007 Z-Host. All rights reserved.                       *
 *                                                                            *
 ******************************************************************************/

// PHPLOCKITOPT NOENCODE

$isearch_path = dirname(__FILE__);
define('IN_ISEARCH', true);

require_once "$isearch_path/inc/core.inc.php";

/* Open the search component (read only) */
isearch_open(True);

/* Check the action and set the page title accordingly */
if (isset($isearch_lang['stats_title']))
{
    $isearch_pageTitle = $isearch_lang['stats_title'];
}
else
{
    $isearch_pageTitle = $isearch_lang['results_title'];
}

echo '

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $isearch_languageCode . '">

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset='.$isearch_config['char_set'].'" />
        <title>' . $isearch_pageTitle . '</title>
        <meta name="author" content="Ian Willis" />
        <meta name="copyright" content="Copyright Z-Host. All rights reserved." />
        <link rel="stylesheet" href="'.$isearch_config['base_url'].'/style/'.$isearch_config['style_name'].'.css" type="text/css" />
    </head>

';

include "$isearch_path/inc/header.inc.php";

echo <<<EOF

        <h1 class="isearch">$isearch_pageTitle</h1>\n

EOF;

if ($isearch_config['total_searches'])
{
    $result = mysql_query("SELECT count(search_term) AS num FROM $isearch_table_search_log");
    if (!$result)
    {
        echo '<p>ERROR: MySQL error : ' . mysql_error() . '</p>';
    }
    else if ($item = mysql_fetch_object($result))
    {
        echo '
        <table summary="' . $isearch_lang['sum_stats_total'] . '" width="100%" border=0 cellpadding=0 class="isearch-stats">
            <caption>Total Searches</caption>
            <thead>
                <tr>
                    <th scope="col">Total Searches</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td style="text-align:center">' . $item->num . '</td>
                </tr>
            </tbody>
        </table>
        <br />
';
    }
}

if ($isearch_config['top_searches'] > 0)
{
    $result = mysql_query("SELECT DISTINCT search_term, matches, count(search_term) AS num FROM $isearch_table_search_log WHERE matches>0 GROUP BY search_term ORDER BY num desc LIMIT " . $isearch_config['top_searches']);
    if (!$result)
    {
        echo '<p>ERROR: MySQL error : ' . mysql_error() . '</p>';
    }
    else
    {
        echo '
        <table summary="' . $isearch_lang['sum_stats_top'] . '" width="100%" border="0" cellpadding="0" class="isearch-stats">
            <caption>' . str_replace("%d", $isearch_config['top_searches'], $isearch_lang['topsearches']) . '</caption>
            <col width="15%" />
            <col width="70%" />
            <col width="15%" />
            <thead>
                <tr>
                    <th scope="col">Searches</th>
                    <th scope="col">' . $isearch_lang['searchterm'] . '</th>
                    <th scope="col">' . $isearch_lang['matches'] . '</th>
                </tr>
            </thead>
            <tbody>
';
        while ($item = mysql_fetch_object($result))
        {
            echo '
                <tr>
                    <td>' . $item->num . '</td>
                    <td><a href="'.$_SERVER['PHP_SELF'] . '?s=' . $item->search_term . '">' . $item->search_term . '</a></td>
                    <td>' . $item->matches . '</td>
                </tr>
';
        }
        echo '
            </tbody>
        </table>
        <br />
';
    }
}

if ($isearch_config['last_searches'] > 0)
{
    $result = mysql_query("SELECT DISTINCT search_term, matches FROM $isearch_table_search_log ORDER BY time desc LIMIT " . $isearch_config['last_searches']);
    if (!$result)
    {
        echo '
        <p>ERROR: MySQL error : ' . mysql_error() . '</p>
';
    }
    else
    {
        echo '
        <table summary="' . $isearch_lang['sum_stats_last'] . '" width="100%" border="0" cellpadding="0" class="isearch-stats">
            <caption>' . str_replace("%d", $isearch_config['last_searches'], $isearch_lang['lastsearches']) . '</caption>
            <col width="85%" />
            <col width="15%" />
            <thead>
                <tr>
                    <th scope="col">' . $isearch_lang['searchterm'] . '</th>
                    <th scope="col">' . $isearch_lang['matches'] . '</th>
                </tr>
            </thead>
            <tbody>
';
        while ($item = mysql_fetch_object($result))
        {
            echo '
                <tr>
                    <td><a href="' . $_SERVER['PHP_SELF'] . '?s=' . $item->search_term . '">' . $item->search_term . '</a></td>
                    <td>' . $item->matches . '</td>
                </tr>
';
        }
        echo '
            </tbody>
        </table>
        <br />
';
    }
}

/* Display the search form */
$s = '';
$partial=False;
$advanced=False;
require_once "$isearch_path/inc/form_internal.inc.php";

/* Close the search component */
isearch_close();

include "$isearch_path/inc/footer.inc.php";

echo <<<EOF

    </body>
</html>

EOF;

?>
Back to Top