function delegate($action) { //cleanCache(); $ds = dataSetName($_GET); $data = loadFromCache($ds); if ($data) { echo $data; exit(0); } switch ($action) { //Twitter case 'topTweets': $data = topTweets(); break; //Google Analytics //Google Analytics case 'chart': $data = getChart(); break; //Events //Events case 'events': $data = getEvents(); break; //Statistics //Statistics case 'stats': $data = getStatistics(); break; //Social badge //Social badge case 'social': $data = generateSocialBadge(); break; } if (!empty($data)) { $val = storeInCache($ds, output($data)); if (!$val) { } } echo output($data); exit(0); }
foreach ($records as $record) { echo "<a target='getMoreInformationIframe' href='getMoreInformation.php?movie_id=" . $record['movie_id'] . "'>"; echo $record['title']; echo "</a>"; echo " - " . $record['description']; echo " - " . $record['rating']; echo " - " . $record['categoryname'] . "<br />"; } ?> </div> <div style="float: left"> <iframe src="getMoreInformation.php" name="getMoreInformationIframe" width="250" height="300" frameborder="0"> </iframe> </div> <div> <h2>Statistics</h2> <?php echo getStatistics(); ?> </div> </div> <footer> <p>© Copyright by Mauro</p> </footer> </div> </body> </html>
function statisticsForm($type) { global $db_con, $mysql_table_prefix, $log_dir, $include_dir, $sites_per_page, $search_script; global $debug, $thumb_dir, $start, $image_dir, $mysql_csize, $mysql_cacheon, $dba_act; global $index_id3, $delim, $thumb_folder; error_reporting(0); echo "<div class='submenu cntr'>| Database {$dba_act} with table prefix '{$mysql_table_prefix}' |</div>\n <div class='submenu y4'>\n <ul>\n <li><a href='admin.php?f=statistics&type=keywords' title='Show list of Top 100 Keywords'>Top keywords</a></li>\n <li><a href='admin.php?f=statistics&type=thumb_files' title='Show list of all indexed thumbnails.'>Indexed Thumbnails</a></li>\n <li><a href='admin.php?f=statistics&type=pages' title='Show list of Largest Pages and their indexed file size'>Largest pages</a></li>\n <li><a href='admin.php?f=statistics&type=spidering_log' title='Show list of Spidering Logs'>Spidering logs</a></li>\n <li><a href='admin.php?f=statistics&type=autoindex' title='Show start time and index counter'>Auto Re-index log file</a></li>\n <li><a href='admin.php?f=statistics&type=ids' title='Show list of intrusion attempts'>IDS log file</a></li>\n <li><a href='admin.php?f=statistics&type=server_info' title='Show all available server info'>Server Info</a></li>\n </ul>\n <br /><br />\n <ul>\n <li><a href='admin.php?f=statistics&type=log' title='Show Search Log activity'>Search log</a></li>\n <li><a href='admin.php?f=statistics&type=top_searches' title='Show list of the most popular on-line Searches'>Most popular searches</a></li>\n <li><a href='admin.php?f=statistics&type=top_links' title='Show list of the most popular page links, clicked by the user'>Most popular page links</a></li>\n <li><a href='admin.php?f=statistics&type=top_media' title='Show list of the most popular media flinks, clicked by the user'>Most popular media links</a></li>\n </ul>\n </div>\n "; if ($type == "") { $cachedSumQuery = "SELECT sum(length(fulltxt)) from " . $mysql_table_prefix . "links"; $result = $db_con->query($cachedSumQuery); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); printf("<p>{$cachedSumQuery}</p>"); exit; } if ($row = $result->fetch_array(MYSQLI_NUM)) { $cachedSumSize = $row[0]; } $cachedSumSize = number_format($cachedSumSize / 1024, 2); $sitesSizeQuery = "SELECT sum(size) from " . $mysql_table_prefix . "links"; $result = $db_con->query("{$sitesSizeQuery}"); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); printf("<p>{$sitesSizeQuery}</p>"); exit; } if ($row = $result->fetch_array(MYSQLI_NUM)) { $sitesSize = $row[0]; } $sitesSize = number_format($sitesSize, 2); $sql_query = "SELECT ip from " . $mysql_table_prefix . "query_log"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $query_tot = '0'; $sql_query = "SELECT count(*) from " . $mysql_table_prefix . "query_log"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } if ($row = $result->fetch_array(MYSQLI_NUM)) { $query_tot = $row[0]; } $page_clicks = '0'; $sql_query = "SELECT sum(click_counter) from " . $mysql_table_prefix . "links"; $result = $db_con->query($sql_query); if (!$db_con->errno) { if ($row = $result->fetch_array(MYSQLI_NUM)) { $page_clicks = $row[0]; } $result = $db_con->query("SELECT count(*) from " . $mysql_table_prefix . "media"); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } if ($row = $result->fetch_array(MYSQLI_NUM)) { $media_tot = $row[0]; } $media_clicks = '0'; $sql_query = "SELECT * from " . $mysql_table_prefix . "media where click_counter > 0"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } if ($row = $result->num_rows) { $media_clicks = $row; } $stats = getStatistics(); echo "<div class='panel w60'>\n <dl class='tblhead'>\n <dt class='headline x2'>Overall Statistics :</dt><dd class='headline'> Counts</dd>\n <dt class='odrow bd x2'>Sites :</dt><dd class='odrow'> " . $stats['sites'] . "</dd>\n <dt class='evrow bd x2'>Links :</dt><dd class='evrow'> " . $stats['links'] . "</dd>\n <dt class='odrow bd x2'>Categories :</dt><dd class='odrow'> " . $stats['categories'] . "</dd>\n <dt class='evrow bd x2'>Keywords :</dt><dd class='evrow'> " . $stats['keywords'] . "</dd>\n <dt class='odrow bd x2'>Media files :</dt><dd class='odrow'> {$media_tot}</dd>\n <dt class='odrow bd x2'>Keyword link-relations :</dt><dd class='odrow'> " . $stats['index'] . "</dd>\n <dt class='evrow bd x2'>Cached texts total :</dt><dd class='evrow'> {$cachedSumSize} kb</dd>\n <dt class='odrow bd x2'>Sites size total :</dt><dd class='odrow'> {$sitesSize} kb</dd>\n <dt class='evrow bd x2'>Queries total :</dt><dd class='evrow'> {$query_tot}</dd>\n <dt class='odrow bd x2'>Page Link clicks total :</dt><dd class='odrow'> {$page_clicks}</dd>\n <dt class='odrow bd x2'>Media Link clicks total :</dt><dd class='odrow'> {$media_clicks}</dd>\n </dl>\n </div>\n "; } else { echo "\n <div class='submenu cntr'>\n <span class='warnadmin'>\n "; echo "<br /><br /><br />\n Invalid database table installation.\n <br />\n </span>\n </div>\n <br /><br />\n "; die; } echo "</div>\n </div>\n </body>\n </html>\n "; exit; } if ($type == 'keywords') { $class = "evrow"; $sql_query = "SELECT keyword, count(" . $mysql_table_prefix . "link_keyword.keyword_id) as x from " . $mysql_table_prefix . "keywords, " . $mysql_table_prefix . "link_keyword\n where " . $mysql_table_prefix . "keywords.keyword_id = " . $mysql_table_prefix . "link_keyword.keyword_id group by keyword order by x desc limit 30"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $num_rows = $result->num_rows; if ($num_rows) { while ($row = $result->fetch_array(MYSQLI_NUM)) { $topwords[$row[0]] = $row[1]; } } arsort($topwords); echo "<div class='panel'>\n <p class='headline cntr'>Top 100 Keywords</p>\n "; $nloops = 1; do { $nloops++; $count = 1; echo "<div class='ltfloat x3'>\n <dl>\n <dt class='headline x2'>Keyword</dt><dd class='headline'>: Instances</dd>\n "; while ((list($word, $weight) = each($topwords)) && $count < 34) { $count++; if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } echo "<dt class='{$class}'><a href='../{$search_script}?query={$word}&search=1' target='rel' title='View search results in new window'>" . trim(substr($word, 0, 35)) . "</a></dt>\n <dd class='{$class}'>: " . $weight . "</dd>\n "; } echo "</dl>\n </div>\n "; } while ($nloops <= 3); echo "<div class='clear'></div>\n <br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br />\n </div>\n </div>\n </div>\n </body>\n </html>\n "; exit; } if ($type == 'pages') { $class = "evrow"; echo "<div class='panel'>\n <dl class='tblhead'>\n <dt class='headline x8'>File Size</dt><dd class='headline cntr'>Links to Largest Pages</dd>\n "; $sql_query = "SELECT " . $mysql_table_prefix . "links.link_id, url, length(fulltxt) as x from " . $mysql_table_prefix . "links order by x desc LIMIT 20"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } while ($row = $result->fetch_array(MYSQLI_NUM)) { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $url = reconvert_url($row[1]); $sum = number_format($row[2] / 1024, 2); echo "<dt class='{$class} x8'>" . $sum . "kb </dt>\n <dd class='{$class}'><a href='{$url}' title='Open this page in new window' target='_blank'>" . $url . "</a></dd>\n "; } echo "</dl>\n <br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br />\n </div>\n </div>\n </div>\n </body>\n </html>\n "; exit; } if ($type == 'top_searches') { $class = "evrow"; echo "<div class='panel'>\n <p class='headline cntr sml'>Most Popular Searches (Top 50)</p>\n <table width='100%'>\n <tr>\n <td class='tblhead'>Query</td>\n <td class='tblhead'>Count</td>\n <td class='tblhead'>Media query</td>\n <td class='tblhead'>Average results</td>\n <td class='tblhead'>Last queried</td>\n <td class='tblhead'>Queried by IP</td>\n <td class='tblhead'>Country</td>\n <td class='tblhead'>Host name</td>\n </tr>\n "; $sql_query = "SELECT query, count(*) as c, date_format(max(time), '%Y-%m-%d %H:%i:%s'), avg(results), media from " . $mysql_table_prefix . "query_log group by query order by c desc LIMIT 50"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } while ($row = $result->fetch_array(MYSQLI_NUM)) { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $word = $row[0]; $times = $row[1]; $date = $row[2]; $media = $row[4]; $avg = number_format($row[3], 0); $word = str_replace("\"", "", $word); $sql_query = "SELECT ip from " . $mysql_table_prefix . "query_log where query='{$word}' order by time desc "; $result1 = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $ips = $result1->fetch_array(MYSQLI_NUM); $ip = $ips[0]; //$ip = "222.46.18.34"; // just for tests if (intval($ip) > 0) { $hostname = @gethostbyaddr($ip); // very slow! comment this row, if not required if ($hostname == $ip) { $hostname = "Unknown host"; } } else { $hostname = "Unknown host"; // a bad address. } // convert any IP into IPv6 $ip6 = IPv4To6($ip); // find Country Code using the IPv6 database and IPV6 IPs $gi = geoip_open("GeoIPv6.dat", GEOIP_STANDARD); $cc = geoip_country_code_by_addr_v6($gi, $ip6); $country = geoip_country_name_by_addr_v6($gi, $ip6); geoip_close($gi); if ($media) { // prepare a media search $sql_query = "query_m=" . $word . "&submit=Media&search=1&media_only=0&cat_sel0=&cat_sel1=&cat_sel2=&cat_sel3=&cat_sel4=&type=and&results=10&db=0&prefix=0"; } else { // prepare a text search $sql_query = "query_t=" . $word . "&submit=Text&search=1&media_only=0&cat_sel0=&cat_sel1=&cat_sel2=&cat_sel3=&cat_sel4=&type=and&mark=blau+markiert&results=10&db=0&prefix=0"; } echo "<tr class='{$class} sml'>\n <td><a href='../{$search_script}?{$query}' target='_blank' title='Open this Log File in new window'>" . $word . "</a></td>\n <td class='cntr'> " . $times . "</td>\n <td class='cntr sml'> " . $media . "</td>\n <td class='cntr'> " . $avg . "</td>\n <td class='cntr'> " . $date . "</td>\n <td class='cntr'> " . $ip . "</td>\n <td class='cntr sml'> " . $cc . " - " . $country . "</td>\n <td class='cntr sml'> " . $hostname . "</td>\n </tr>\n "; } echo "\n </table>\n <br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br />\n </div>\n </div>\n </div>\n </body>\n </html>\n "; exit; } if ($type == 'top_links') { $class = "evrow"; echo "<div class='panel'>\n <p class='headline cntr sml'>Most Popular Links (Top 50)</p>\n <table width='100%'>\n <tr>\n <td class='tblhead'>Link</td>\n <td class='tblhead'>Total clicks</td>\n <td class='tblhead'>Last clicked</td>\n <td class='tblhead'>Last query</td>\n <td class='tblhead'>Queried<br />by IP</td>\n <td class='tblhead'>Country</td>\n <td class='tblhead'>Host name</td>\n </tr>\n "; $sql_query = "SELECT url, click_counter, last_click, last_query from " . $mysql_table_prefix . "links order by click_counter DESC, url LIMIT 50"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } while ($row = $result->fetch_array(MYSQLI_NUM)) { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $url = reconvert_url($row[0]); $click_counter = $row[1]; $Timestamp = $row[2]; $last_query = $row[3]; if ($Timestamp != '0') { $last_click = date("Y-m-d H:i:s", $Timestamp); $sql_query = "SELECT ip from " . $mysql_table_prefix . "links where last_query='{$last_query}' order by last_click desc "; $result1 = $db_con->query($sql_query); $ips = $result1->fetch_array(MYSQLI_NUM); $ip = $ips[0]; //$ip = "222.46.18.34"; // just for tests if (intval($ip) > 0) { $hostname = @gethostbyaddr($ip); // very slow! comment this row, if not required if ($hostname == $ip) { $hostname = "Unknown host"; } } else { $hostname = "Unknown host"; // a bad address. } // convert any IP into IPv6 $ip6 = IPv4To6($ip); // find Country Code using the IPv6 database and IPV6 IPs $gi = geoip_open("GeoIPv6.dat", GEOIP_STANDARD); $cc = geoip_country_code_by_addr_v6($gi, $ip6); $country = geoip_country_name_by_addr_v6($gi, $ip6); geoip_close($gi); echo "<tr class='{$class} sml'>\n <td><a href='{$url}' target='rel' title='View link in new window'>" . htmlentities($url) . "</a></td>\n <td class='cntr sml'> " . $click_counter . "</td>\n <td class='cntr sml'> " . $last_click . "</td>\n <td class='cntr sml'> " . $last_query . "</td>\n <td class='cntr'> " . $ip . "</td>\n <td class='cntr sml'> " . $cc . " - " . $country . "</td>\n <td class='cntr sml'> " . $hostname . "</td>\n </tr>\n "; } } echo "\n </table>\n <br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br />\n </div>\n </div>\n </div>\n </body>\n </html>\n "; exit; } if ($type == 'top_media') { $class = "evrow"; echo "<div class='panel'>\n <p class='headline cntr sml'>Most Popular Media (Top 50)</p>\n <form action='' id='fdeltm'>\n <table width='100%'>\n <tr>\n <td colspan='5' class='odrow bd'>\n <input type='hidden' name='f' value='14' />\n <input class='sbmt' id='submit11' type='submit' value='Clear this statistics' title='Start statistics deletion'\n onclick=\"return confirm('Are you sure you want to delete the 'Most popular media' statistics?')\" />\n </td>\n </tr>\n <tr>\n <td class='tblhead'>Thumbnail</td>\n <td class='tblhead'>Details</td>\n <td class='tblhead'>Total clicks</td>\n <td class='tblhead'>Last clicked</td>\n <td class='tblhead'>Last query</td>\n <td class='tblhead'>Queried<br />by IP</td>\n <td class='tblhead'>Country</td>\n <td class='tblhead'>Host name</td>\n </tr>\n "; $sql_query = "SELECT link_addr, media_link, thumbnail, title, type, click_counter, last_click, last_query from " . $mysql_table_prefix . "media order by click_counter DESC, media_link LIMIT 50"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } while ($row = $result->fetch_array(MYSQLI_NUM)) { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $title = substr($row[3], 0, strpos($row[3], $delim)); // extract original title without transliterated words $name0 = basename($var[1]); // extract file name $name = substr($name0, 0, strrpos($name0, ".")); // remove original suffix $last_query = $row[7]; // add folder path, db, table-prefix and add own suffix $file = utf8_decode("." . $thumb_folder . "/db" . $dba_act . "_" . $mysql_table_prefix . "_" . $name . ".gif"); // temporary save thumbnail in folder if (!($handle = fopen($file, "ab"))) { if ($debug > 0) { print "Unable to open {$file} "; } } if (!fwrite($handle, $row[2])) { if ($debug > 0) { print "Unable to write the file {$file}. No thumbnails will be presented"; } } fclose($handle); if ($row[4] == 'audio') { // use dummy thumbnail $thumb_link = "{$image_dir}/notes60.gif"; } if ($row[4] == 'video') { // use dummy thumbnail $thumb_link = "{$image_dir}/film60.gif"; } if ($row[6] != '0') { $last_click = date("Y-m-d H:i:s", $row[6]); $sql_query = "SELECT ip from " . $mysql_table_prefix . "media where last_query='{$last_query}' order by last_click desc "; $result1 = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $ips = $result1->fetch_array(MYSQLI_NUM); $ip = $ips[0]; //$ip = "222.46.18.34"; // just for tests if (intval($ip) > 0) { $hostname = @gethostbyaddr($ip); // very slow! comment this row, if not required if ($hostname == $ip) { $hostname = "Unknown host"; } } else { $hostname = "Unknown host"; // a bad address. } // convert any IP into IPv6 $ip6 = IPv4To6($ip); // find Country Code using the IPv6 database and IPV6 IPs $gi = geoip_open("GeoIPv6.dat", GEOIP_STANDARD); $cc = geoip_country_code_by_addr_v6($gi, $ip6); $country = geoip_country_name_by_addr_v6($gi, $ip6); geoip_close($gi); echo "<tr class='{$class} sml'>\n <td class='cntr'><a href='{$row['1']}' target='rel' title='Open this object'><img src='{$file}' border='1' alt='Open this object' /></a></td>\n <td><strong>Title:</strong> {$title}\n <br /><br />\n <strong>Found at:</strong> <a href='{$row['0']}' target='rel' title='Open this page in a new window'>{$row['0']}</a></td>\n <td class='cntr sml'> " . $row[5] . "</td>\n <td class='cntr sml'> " . $last_click . "</td>\n <td class='cntr sml'> " . $row[7] . "</td>\n <td class='cntr'> " . $ip . "</td>\n <td class='cntr sml'> " . $cc . " - " . $country . "</td>\n <td class='cntr sml'> " . $hostname . "</td>\n </tr>\n "; } } echo "\n </table>\n </form>\n <br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br />\n </div>\n </div>\n </div>\n </body>\n </html>\n "; exit; } if ($type == 'autoindex') { $i = "0"; $logfolder = "./log/"; if ($handle = opendir($logfolder)) { // open log-folder echo "<div class='panel'>\n "; while (false !== ($logfile = readdir($handle))) { //get all log files if (strstr($logfile, "db" . $dba_act . "_" . $mysql_table_prefix . "")) { //separate only log files of current active db and table prefix $att = ''; if (strstr($logfile, "._all")) { // this log file was created during 'Re-index all sites' $att = "all"; } else { // this log file was created during individual site indexing // extract site_id from file name $end = strrpos($logfile, "_"); $start = strpos($logfile, "._") + 2; $site_id = substr($logfile, $start, $end - $start); // get URL according to actual site_id $sql_query = "SELECT * from " . $mysql_table_prefix . "sites where site_id={$site_id}"; $result = $db_con->query($sql_query); $row = $result->fetch_array(MYSQLI_ASSOC); $site_url = $row['url']; } // build some nice headlines for monitor output if ($att) { $headline = "Periodical Re-indexer<br /><br />Log file created during indexing all sites"; } else { $headline = "<br >Periodical Re-indexer<br /><br />Log file created during indexing<br />{$site_url}<br />Site id: {$site_id}"; } $content = @file("log/" . $logfile . ""); // get content of the current logfile // output the periodical Re-indexer for each log file $class = "evrow"; echo "<p class='headline cntr sml'>{$headline}</p>\n <br />\n <table width='50%'>\n <tr>\n <td class='tblhead'>Index counter</td>\n <td class='tblhead'>Started</td>\n </tr>\n "; foreach ($content as $thisrow) { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $counter = substr($thisrow, 0, strpos($thisrow, "count")); $started = date("Y-m-d H:i:s", substr($thisrow, strpos($thisrow, "count") + 5)); // if Auto-indexer already finished by count limit if (strpos($thisrow, "inish")) { $counter = "finished:"; $started = date("Y-m-d H:i:s", substr($thisrow, strpos($thisrow, "finished") + 8)); } // if Auto-indexer already finished because interval was too short if (strpos($thisrow, "borted")) { $counter = "Aborted because<br />interval too short"; $started = date("Y-m-d H:i:s", substr($thisrow, strpos($thisrow, "finished") + 7)); } echo " <tr class='{$class} sml'>\n <td class='cntr'>{$counter}</td>\n <td class='cntr'>{$started}</td>\n </tr>\n "; } echo "</table>\n <br /><br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br /><br />\n "; $i++; } } if ($i < "1") { echo "<br />\n <p class='cntr msg'>Note: <span class='warnadmin'>Currently no log file available</span></p>\n "; } } echo "<br />\n </div>\n <br />\n </body>\n </html>\n "; exit; } if ($type == 'log') { $class = "evrow"; echo "<div class='panel w100'>\n <p class='headline cntr sml'>Search Log (Latest 100)</p>\n <table width='100%'>\n <tr>\n <td class='tblhead'>Query</td>\n <td class='tblhead'>Media query</td>\n <td class='tblhead'>Results</td>\n <td class='tblhead'>Queried at:</td>\n <td class='tblhead'>Time taken</td>\n <td class='tblhead'>User IP</td>\n <td class='tblhead'>Country</td>\n <td class='tblhead'>Host name</td>\n </tr>\n "; $sql_query = "SELECT query, date_format(time, '%Y-%m-%d %H:%i:%s'), elapsed, results, ip, media from " . $mysql_table_prefix . "query_log order by time desc LIMIT 100"; $result = $db_con->query($sql_query); while ($row = $result->fetch_array(MYSQLI_NUM)) { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $query = ''; $word = $row[0]; $time = $row[1]; $elapsed = $row[2]; $results = $row[3]; $ip = $row[4]; $media = $row[5]; //$ip = "222.46.18.34"; // just for tests if (intval($ip) > 0) { $hostname = @gethostbyaddr($ip); // very slow! comment this row, if not required if ($hostname == $ip) { $hostname = "Unknown host"; } } else { $hostname = "Unknown host"; // a bad address. } // convert any IP into IPv6 $ip6 = IPv4To6($ip); // find Country Code using the IPv6 database and IPV6 IPs $gi = geoip_open("GeoIPv6.dat", GEOIP_STANDARD); $cc = geoip_country_code_by_addr_v6($gi, $ip6); $country = geoip_country_name_by_addr_v6($gi, $ip6); geoip_close($gi); if ($media) { // prepare a media search $query = "query_m=" . $word . "&submit=Media&search=1&media_only=0&cat_sel0=&cat_sel1=&cat_sel2=&cat_sel3=&cat_sel4=&type=and&results=10&db=0&prefix=0"; } else { // prepare a text search $query = "query_t=" . $word . "&submit=Text&search=1&media_only=0&cat_sel0=&cat_sel1=&cat_sel2=&cat_sel3=&cat_sel4=&type=and&mark=blau+markiert&results=10&db=0&prefix=0"; } echo "<tr class='{$class}'>\n <td><a href='../{$search_script}?{$query}' target='_blank' title='Open this Log File in new window'>" . $word . "</a></td>\n <td class='cntr sml'> " . $media . "</td>\n <td class='cntr sml'> " . $results . "</td>\n <td class='cntr sml'> " . $time . "</td>\n <td class='cntr sml'> " . $elapsed . "</td>\n <td class='cntr sml'> " . $ip . "</td>\n <td class='cntr sml'> " . $cc . " - " . $country . "</td>\n <td class='cntr sml'> " . $hostname . "</td>\n </tr>\n "; } echo "\n </table>\n <br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br />\n </div>\n </div>\n </div>\n </body>\n </html>\n "; exit; } if ($type == 'spidering_log') { $class = "evrow"; $files = get_dir_contents($log_dir); if (count($files) > 0) { echo "<div class='panel w75'>\n <p class='headline cntr'>Spidering Logs</p>\n <form action='' id='fdelfm'>\n <table width='100%'>\n <tr>\n <td class='tblhead'>File</td>\n <td class='tblhead'>Created</td>\n <td class='tblhead' width='25%'>Option</td>\n </tr>\n <tr>\n <td colspan='3' class='odrow cntr bd'>\n <input type='hidden' name='f' value='44'\n />\n <input class='sbmt' id='submit1' type='submit' value='Delete ALL log files' title='Start Log File deletion'\n onclick=\"return confirm('Are you sure you want to delete ALL log files? ATTENTION: A still running periodical indexing will be aborted.')\" />\n </td>\n </tr>\n "; for ($i = 0; $i < count($files); $i++) { $file = $files[$i]; $year = substr($file, 4, 2); $month = substr($file, 6, 2); $day = substr($file, 8, 2); $hour = substr($file, 11, 2); $minute = substr($file, 14, 2); $second = substr($file, 17, 2); if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } echo "<tr class='{$class}'>\n <td class='cntr sml'>\n <a href='{$log_dir}/{$file}' target='_blank' title='Open this Log File in new window'>{$file}</a></td>\n "; if (strlen($file) > '13') { if (strstr($file, "auto-indexer")) { // the log-file for the Auto Re-indexer $logfile = "log/db" . $dba_act . "_" . $mysql_table_prefix . "._all_auto-indexer.log"; $content = @file($logfile); // content of the logfile $started = date("Y-m-d H:i:s", substr($content[0], strpos($content[0], "count") + 5)); echo " <td class='cntr sml'>{$started}</td>\n <td class='cntr sml options'><a href='?f=delete_log&file={$file}' class='options' title='Click to Delete this Log File'\n onclick=\"return confirm('Are you sure you want to delete? {$file} ATTENTION: Deleting this Log File may abort periodical Re-indexing.')\">Delete</a></td>\n "; } else { echo " <td class='cntr sml'>20{$year}-{$month}-{$day} {$hour}:{$minute}.{$second}</td>\n <td class='cntr sml options'><a href='?f=delete_log&file={$file}' class='options' title='Click to Delete this Log File'\n onclick=\"return confirm('Are you sure you want to delete '{$file}' Indexing Log File will be lost.')\">Delete</a></td>\n "; } } else { echo " <td></td><td></td>\n "; } echo "\n </tr>\n "; } echo "\n </table></form>\n <br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br />\n </div>\n "; } else { echo "<br />\n <p class='cntr msg'>Note: <span class='warnadmin'>No saved spidering logs exist!</span></p>\n <br /> <br />\n "; } echo "</div>\n </div>\n </body>\n </html>\n "; exit; } if ($type == 'thumb_files') { if ($thumb_folder) { // delete all former thumbnails in temporary folder clear_folder("." . $thumb_folder); } $class = "odrow"; $files = array(); $sql_query = "SELECT media_id from " . $mysql_table_prefix . "media"; $result = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $thumb_count = $result->num_rows; if ($thumb_count) { while ($row = $result->fetch_array(MYSQLI_ASSOC)) { $files[] = $row['media_id']; } } //Prepare thumbnails and their info for listing //$sites_per_page = '100'; // if you prefer another count than used for Sphiders result pages, uncomment this row and place your count of thumbnails per page here. $pages = ceil($thumb_count / $sites_per_page); // Calculate count of required pages if (empty($start)) { $start = '1'; } // As $start is not yet defined this is required for the first result page if ($start == '1') { $from = '0'; // Also for first page in order not to multipy with 0 } else { $from = ($start - 1) * $sites_per_page; // First $num_row of actual page } $to = $thumb_count; // Last $num_row of actual page $rest = $thumb_count - $start; if ($thumb_count > $sites_per_page) { // Display more then one page? $rest = $thumb_count - $from; $to = $from + $rest; // $to for last page if ($rest > $sites_per_page) { $to = $from + $sites_per_page; } // Calculate $num_row of actual page } if ($thumb_count > '0') { $fromm = $from + 1; echo "<div class='panel'>\n <p class='headline cntr sml'>Displaying thumbnails {$fromm} - {$to} from {$thumb_count}</p>\n <form action='' id='fdelfm'>\n <table width='100%'>\n <tr>\n <td class='tblhead' width='30%'>Thumbnail</td>\n <td class='tblhead'>Details</td>\n <td class='tblhead' width='20%'>Option</td>\n </tr>\n <tr>\n <td colspan='3' class='odrow bd'>\n <input type='hidden' name='f' value='49' />\n <input class='sbmt' id='submit1' type='submit' value='Delete ALL images' title='Start File deletion'\n onclick=\"return confirm('Are you sure you want to delete ALL indexed images \\n and ALL thumbnail files?')\" />\n </td>\n </tr>\n "; for ($i = $from; $i < $to; $i++) { $this_thumb = $files[$i]; $i_1 = $i + 1; // so table output does not start with zero $result = $db_con->query("SELECT media_id, media_link, thumbnail, title from " . $mysql_table_prefix . "media where media_id like '{$this_thumb}'"); if ($result->num_rows > '0') { $var = $result->fetch_array(MYSQLI_NUM); $media_id = $var[0]; $this_img = $var[1]; $title = substr($var[3], 0, strpos($var[3], $delim)); // extract original title without transliterated words $name0 = basename($var[1]); // extract file name $name = substr($name0, 0, strrpos($name0, ".")); // remove original suffix // add folder path, db, table-prefix and add own suffix $file = utf8_decode("." . $thumb_folder . "/db" . $dba_act . "_" . $mysql_table_prefix . "_" . $name . ".gif"); // temporary save thumbnail in folder if (!($handle = fopen($file, "ab"))) { if ($debug > 0) { print "Unable to open {$file} "; } } if (!fwrite($handle, $var[2])) { if ($debug > 0) { print "Unable to write the file {$file}. No thumbnails will be presented"; } } fclose($handle); } if ($class == "odrow") { $class = "evrow"; } else { $class = "odrow"; } echo " <tr class='{$class}'>\n <td class='cntr x4'>\n <a href='{$this_img}' target='rel' title='View the real image (not only the thumbnail) in new window'><img src=\"{$file}\" border='1' alt=\"Thumbnail\" /></a>\n </td>\n <td class='lft sml'>\n <p> Thumb no.: {$i_1}</p>\n <p> File name: {$name0}</p>\n <p> Title: {$title}</p>\n <p> Thumb_ID : {$media_id}</p>\n "; if ($index_id3 == '1') { echo "<p><a href='" . $include_dir . "/show_id3.php?media_id={$media_id}' target='rel' title='Click here to see EXIF and ID3 Infos in a new window'>Show EXIF Info</a></p>\n "; } echo "</td>\n <td class='cntr sml options'>\n <a href='?f=delete_thumb&file={$media_id}' class='options' title='Click to delete this thumbnail'\n onclick=\"return confirm('Are you sure you want to delete \\'{$name}\\'. \\nThumbnail file will be lost.')\">Delete</a>\n </td>\n </tr>\n "; } echo "</table>\n </form>\n <br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br />\n </div>\n "; // Display end of table if ($thumb_count > 0) { echo "\n <br />"; if ($pages > 1) { // If we have more than 1 result-page echo "\n <div class='submenu cntr'>\n Result page: {$start} from {$pages} \n "; if ($start > 1) { // Display 'First' echo "\n <a href='admin.php?f=statistics&type=thumb_files&start=1'>First</a> \n "; if ($start > 5) { // Display '-5' $minus = $start - 5; echo "\n <a href='admin.php?f=statistics&type=thumb_files&start={$minus}'>- 5</a> \n "; } } if ($start > 1) { // Display 'Previous' $prev = $start - 1; echo "\n <a href='admin.php?f=statistics&type=thumb_files&start={$prev}'>Previous</a> \n "; } if ($rest >= $sites_per_page) { // Display 'Next' $next = $start + 1; echo "\n <a href='admin.php?f=statistics&type=thumb_files&start={$next}' >Next</a> \n "; if ($pages - $start > 5) { // Display '+5' $plus = $start + 5; echo "\n <a href='admin.php?f=statistics&type=thumb_files&start={$plus}'>+ 5</a> \n "; } } if ($start < $pages) { // Display 'Last' echo "\n <a href='admin.php?f=statistics&type=thumb_files&start={$pages}'>Last</a>\n "; } echo "</div>\n "; } } } else { echo "<br />\n <p class='cntr msg'>Note: <span class='warnadmin'>No saved thumbnails exist!</span></p>\n <br /> <br />\n "; } echo "\n </div>\n </body>\n </html>\n "; exit; } if ($type == "ids") { $back = ''; showIDS($back); exit; } if ($type = 'server_info') { $s_infos = str_replace("&", "&", $_SERVER); $e_infos = str_replace("&", "&", $_ENV); echo "<div class='submenu'>\n <ul>\n <li><a href='#serv_info'>Server</a></li>\n <li><a href='#en_info'>Environment</a></li>\n <li><a href='#mysql_info'>MySQL</a></li>\n <li><a href='#pdf_con'>PDF-converter</a></li>\n <li><a href='#gd_info'>Image func.</a></li>\n <li><a href='#php_ini'>php.ini file</a></li>\n <li><a href='admin.php?f=35'>PHP integration</a></li>\n <li><a href='#php_sec'>PHP security info</a></li>\n </ul>\n </div>\n <div class='tblhead sml'><a name='serv_info'>Server</a> </div>\n <table width='98%'>\n <tr>\n <td width='20%' class='tblhead'>Key</td>\n <td class='tblhead'>Value</td>\n\n </tr>\n "; $bgcolor = 'odrow'; $i = 0; reset($s_infos); while (list($key, $value) = each($s_infos)) { echo "<tr class='{$bgcolor} cntr'>\n <td>{$key}</td>\n <td class='bordl'>{$value}</td>\n </tr>\n "; $i++; if ($bgcolor == 'odrow') { $bgcolor = 'evrow'; } else { $bgcolor = 'odrow'; } } echo "\n </table><br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br /><br />\n <div class='headline cntr sml'><a name='en_info'>Environment</a></div>\n <table width='98%'>\n <tr>\n <td width='20%' class='tblhead'>Key</td>\n <td class='tblhead'>Value</td>\n\n </tr>\n "; $bgcolor = 'odrow'; $i = 0; reset($e_infos); while (list($key, $value) = each($e_infos)) { echo "<tr class='{$bgcolor} cntr'>\n <td>{$key}</td>\n <td class='bordl'>{$value}</td>\n </tr>\n "; $i++; if ($bgcolor == 'odrow') { $bgcolor = 'evrow'; } else { $bgcolor = 'odrow'; } } echo "\n </table><br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n "; $server_version = $db_con->server_info; $host_info = $db_con->host_info; $client_info = $db_con->client_info; $protocol_version = $db_con->protocol_version; $sql_query = "SHOW STATUS LIKE 'Qcache_free_memory'"; $status = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $row = $status->fetch_array(MYSQLI_ASSOC); $cmem_size = $row['Value']; echo "<br /><br />\n <div class='headline cntr sml'><a name='mysql_info'>MySQL Info</a></div>\n <table width='98%'>\n <tr>\n <td width='35%' class='tblhead'>Key</td>\n <td class='tblhead'>Value</td>\n </tr>\n "; $bgcolor = 'odrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>MySQL Server version</td>\n <td class='bordl'>{$server_version}</td>\n </tr>\n "; $bgcolor = 'evrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Connection info</td>\n <td class='bordl'>{$host_info}</td>\n </tr>\n "; $bgcolor = 'odrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Client library info</td>\n <td class='bordl'>{$client_info}</td>\n </tr>\n "; $bgcolor = 'evrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>MySQL protocol version</td>\n <td class='bordl'>{$protocol_version}</td>\n </tr>\n "; $bgcolor = 'odrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Support for mysqli</td>\n <td class='bordl'>See below as part of your PHP installation</td>\n </tr>\n "; $bgcolor = 'evrow'; echo "<tr><td></td><td></td></tr>\n <tr class='{$bgcolor} cntr'>\n <td>MySQL cache</td>\n "; if ($cmem_size == '0') { echo "<td class='warnadmin'>Cache is not initialized</td>"; } else { echo "<td class='bordl'>32 MByte initialized</td>\n </tr>\n "; $bgcolor = 'odrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Currently free cache size</td>\n <td class='bordl'>{$cmem_size} Bytes</td>\n </tr>\n "; $sql_query = "SHOW STATUS LIKE 'Qcache_total_blocks'"; $status = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $row = $status->fetch_array(MYSQLI_ASSOC); $ctot_blocks = $row['Value']; $bgcolor = 'evrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Cache total blocks</td>\n <td class='bordl'>{$ctot_blocks}</td>\n </tr>\n "; $sql_query = "SHOW STATUS LIKE 'Qcache_free_blocks'"; $status = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $row = $status->fetch_array(MYSQLI_ASSOC); $cfree_blocks = $row['Value']; $bgcolor = 'odrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Cache free blocks</td>\n <td class='bordl'>{$cfree_blocks}</td>\n </tr>\n "; $sql_query = "SHOW STATUS LIKE 'Qcache_hits'"; $status = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $row = $status->fetch_array(MYSQLI_ASSOC); $cache_hits = $row['Value']; $bgcolor = 'evrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Cache hits</td>\n <td class='bordl'>{$cache_hits}</td>\n </tr>\n "; $sql_query = "SHOW STATUS LIKE 'Qcache_inserts'"; $status = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $row = $status->fetch_array(MYSQLI_ASSOC); $cache_inserts = $row['Value']; $bgcolor = 'odrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Cache inserts</td>\n <td class='bordl'>{$cache_inserts}</td>\n </tr>\n "; $sql_query = "SHOW STATUS LIKE 'Qcache_queries_in_cache'"; $status = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $row = $status->fetch_array(MYSQLI_ASSOC); $queries_in_cache = $row['Value']; $bgcolor = 'evrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Queries in cache</td>\n <td class='bordl'>{$queries_in_cache}</td>\n </tr>\n "; $sql_query = "SHOW STATUS LIKE 'Qcache_not_cached'"; $status = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $row = $status->fetch_array(MYSQLI_ASSOC); $q_not_cached = $row['Value']; $bgcolor = 'odrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Queries not cached</td>\n <td class='bordl'>{$q_not_cached}</td>\n </tr>\n "; $sql_query = "SHOW STATUS LIKE 'Qcache_lowmem_prunes'"; $status = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } $row = $status->fetch_array(MYSQLI_ASSOC); $q_low_prun = $row['Value']; $bgcolor = 'evrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Not cached because low memory</td>\n <td class='bordl'>{$q_low_prun}</td>\n </tr>\n "; } echo "\n </table><br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n "; $os = ''; $os = $_ENV['OS']; // not all shared hosting server will supply this info $admin_path = $_ENV['ORIG_PATH_TRANSLATED']; // that might work for shared hosting server $admin_file = $_SERVER['SCRIPT_FILENAME']; // should present the physical path $sdoc_root = $_SERVER['DOCUMENT_ROOT']; // this should provide every hoster (???) $edoc_root = $_ENV['DOCUMENT_ROOT']; // this should provide every hoster (???) echo "<br /><br />\n <div class='headline cntr sml'><a name='pdf_con'>PDF-converter relevant Info</a></div>\n <table width='98%'>\n <tr>\n <td width='35%' class='tblhead'>Key</td>\n <td class='tblhead'>Value</td>\n </tr>\n "; $bgcolor = 'odrow'; if ($os) { echo "\n <tr class='{$bgcolor} cntr'>\n <td>Operating System</td>\n <td class='bordl'>{$os}</td>\n </tr>\n "; $bgcolor = 'evrow'; } if (!$os) { $s_soft = $_SERVER['SERVER_SOFTWARE']; $sys_os = stripos($s_soft, "lin"); if (!$sys_os) { $sys_os = stripos($s_soft, "uni"); if (!$sys_os) { $sys_os = stripos($s_soft, "win"); } } if ($sys_os) { $os = substr($s_soft, $sys_os, '5'); echo "\n <tr class='{$bgcolor} cntr'>\n <td>Operating System</td>\n <td class='bordl'>{$os}</td>\n </tr>\n "; $bgcolor = 'evrow'; } else { $s_sig = $_SERVER['SERVER_SIGNATURE']; $sys_os = stripos($s_sig, "lin"); if (!$sys_os) { $sys_os = stripos($s_sig, "uni"); if (!$sys_os) { $sys_os = stripos($s_sig, "win"); } } } if ($sys_os) { $os = substr($s_sig, $sys_os, '5'); echo "\n <tr class='{$bgcolor} cntr'>\n <td>Operating System</td>\n <td class='bordl'>{$os}</td>\n </tr>\n "; $bgcolor = 'evrow'; } } // if ENV or SERVER_SIGNATURE or SERVER_SOFTWARE do not deliver OperatingSystem info, we will use the PHPinfo to extract it if (!$os) { $phpinfo = ''; ob_start(); // redirect output into buffer phpinfo(); $phpinfo = ob_get_contents(); // get all from phpinfo ob_end_clean(); // clean buffer and close it // extract OS information $start = stripos($phpinfo, "\"v\"") + 4; $end = stripos($phpinfo, "</td>", $start); $length = $end - $start; $os = substr($phpinfo, $start, $length); echo "\n <tr class='{$bgcolor} cntr'>\n <td>Operating System</td>\n <td class='bordl'>{$os}</td>\n </tr>\n "; $bgcolor = 'evrow'; } if ($admin_path) { $admin_path = str_replace("\\\\", "/", $admin_path); $admin_path = str_replace("\\", "/", $admin_path); $pdf_path = substr($admin_path, 0, strrpos($admin_path, "/")); $pdf_path = substr($pdf_path, 0, strrpos($pdf_path, "/")); $pdf_path = "" . $pdf_path . "/converter/pdftotext"; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Physical path to Sphider-plus Admin</td>\n <td class='bordl'>{$admin_path}</td>\n </tr>\n "; $bgcolor = 'odrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Physical path to the Linux / UNIX PDF-converter</td>\n <td class='bordl'>{$pdf_path}</td>\n </tr>\n "; $bgcolor = 'evrow'; } else { if ($admin_file) { $admin_file = str_replace("\\\\", "/", $admin_file); $admin_file = str_replace("\\", "/", $admin_file); $pdf_path = substr($admin_file, 0, strrpos($admin_file, "/")); $pdf_path = substr($pdf_path, 0, strrpos($pdf_path, "/")); $pdf_path = "" . $pdf_path . "/converter/pdftotext"; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Physical path to Sphider-plus Admin</td>\n <td class='bordl'>{$admin_file}</td>\n </tr>\n "; $bgcolor = 'odrow'; echo "\n <tr class='{$bgcolor} cntr'>\n <td>Physical path to the Linux / UNIX PDF-converter</td>\n <td class='bordl'>{$pdf_path}</td>\n </tr>\n "; $bgcolor = 'evrow'; } } if ($sdoc_root) { echo "\n <tr class='{$bgcolor} cntr'>\n <td>Physical path to document root</td>\n <td class='bordl'>{$sdoc_root}</td>\n </tr>\n "; } else { if ($edoc_root) { echo "\n <tr class='{$bgcolor} cntr'>\n <td>Physical path to document root</td>\n <td class='bordl'>{$edoc_root}</td>\n </tr>\n "; } } if (!$admin_path && !$admin_file) { if ($sdoc_root) { echo "\n <tr class='{$bgcolor} cntr'>\n <td>Physical path to document root</td>\n <td class='bordl'>{$sdoc_root}</td>\n </tr>\n "; } if ($edoc_root) { echo "\n <tr class='{$bgcolor} cntr'>\n <td>Physical path to document root</td>\n <td class='bordl'>{$edoc_root}</td>\n </tr>\n "; } else { echo "\n </table>\n <table width='98%'>\n <tr>\n <td>\n <span class='cntr warnadmin'><br />\n Attention: Your server does not deliver information about the physical path to Sphider-plus.<br />\n For LINUX and UNIX systems you will have to initialize the PDF converter manually.<br />\n For details see the file readme.pdf, chapter: PDF converter for Linux/UNIX systems.<br />\n <br /></span>\n </td>\n </tr>\n "; } } echo "\n </table><br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a><br /><br />\n "; if (function_exists(gd_info)) { $gd = gd_info(); // get details about image functions } echo "<br /><br />\n <div class='headline cntr sml'><a name='gd_info'>Info about Image Functions (GD-library)</a></div>\n <table width='98%'>\n <tr>\n <td width='50%' class='tblhead'>Key</td>\n <td class='tblhead'>Value</td>\n </tr>\n "; if ($gd) { $bgcolor = "evrow"; foreach ($gd as $key => $val) { if ($bgcolor == "evrow") { $bgcolor = "odrow"; } else { $bgcolor = "evrow"; } echo "\n <tr class='{$bgcolor} cntr'>\n <td>{$key}</td>\n <td class='bordl'>{$val}</td>\n </tr>\n "; } } else { echo "\n <tr class='warnadmin cntr'>\n <td>Image functions are not installed.</td>\n <td>You will need to compile PHP with the GD library.</td>\n </tr>\n "; } echo "\n </table><br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a><br /><br />\n "; echo "\n <div class='headline cntr sml'>PHP Info</div>\n <br />\n <div class='headline cntr sml'><a name='php_ini'>php.ini file</a></div>\n <table width='98%'>\n <tr>\n <td width='20%' class='tblhead'>Key</td>\n <td class='tblhead'>Value</td>\n\n </tr>\n "; $php_ini = str_replace("&", "&", ini_get_all()); $bgcolor = 'odrow'; $i = 0; reset($php_ini); while (list($key, $value) = each($php_ini)) { echo "\n <tr class='{$bgcolor} cntr'>\n <td>{$key}</td>\n <td class='bordl'>\n "; print_r($value); echo "\n </td>\n </tr>\n "; $i++; if ($bgcolor == 'odrow') { $bgcolor = 'evrow'; } else { $bgcolor = 'odrow'; } } echo "\n </table>\n <br /><br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br /><br />\n <div class='headline cntr sml'><a name='php_sec'>PHP security info</a></div>\n <table width='98%'>\n <tr>\n <td width='20%' class='tblhead'></td>\n <td class='tblhead'></td>\n\n </tr>\n "; //phpsecinfo(); // get PHP security information echo "\n </table>\n <br /><br />\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\n <br /><br />\n </div>\n "; exit; } }
function statisticsForm($type) { global $mysql_table_prefix, $log_dir; ?> <div id='submenu'> <ul> <li><a href="admin.php?f=statistics&type=keywords">Top keywords</a></li> <li><a href="admin.php?f=statistics&type=pages">Largest pages</a></li> <li><a href="admin.php?f=statistics&type=top_searches">Most popular searches</a></li> <li><a href="admin.php?f=statistics&type=log">Search log</a></li> <li><a href="admin.php?f=statistics&type=spidering_log">Spidering logs</a></li> </ul> </div> <?php if ($type == "") { $cachedSumQuery = "select sum(length(fulltxt)) from " . $mysql_table_prefix . "links"; $result = mysql_query("select sum(length(fulltxt)) from " . $mysql_table_prefix . "links"); echo mysql_error(); if ($row = mysql_fetch_array($result)) { $cachedSumSize = $row[0]; } $cachedSumSize = number_format($cachedSumSize / 1024, 2); $sitesSizeQuery = "select sum(size) from " . $mysql_table_prefix . "links"; $result = mysql_query("{$sitesSizeQuery}"); echo mysql_error(); if ($row = mysql_fetch_array($result)) { $sitesSize = $row[0]; } $sitesSize = number_format($sitesSize, 2); $stats = getStatistics(); print "<br/><div align=\"center\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td><b>Sites:</b></td><td align=\"center\">" . $stats['sites'] . "</td></tr>"; print "<tr class=\"white\"><td><b>Links:</b></td><td align=\"center\"> " . $stats['links'] . "</td></tr>"; print "<tr class=\"grey\"><td><b>Categories:</b></td><td align=\"center\"> " . $stats['categories'] . "</td></tr>"; print "<tr class=\"white\"><td><b>Keywords:</b></td><td align=\"center\"> " . $stats['keywords'] . "</td></tr>"; print "<tr class=\"grey\"><td><b>Keyword-link realations:</b></td><td align=\"center\"> " . $stats['index'] . "</td></tr>"; print "<tr class=\"white\"><td><b>Cached texts total:</b></td><td align=\"center\"> {$cachedSumSize} kb</td></tr>"; print "<tr class=\"grey\"><td><b>Sites size total:</b></td><td align=\"center\"> {$sitesSize} kb</td></tr>"; print "</table></td></tr></table></div>"; } if ($type == 'keywords') { $class = "grey"; print "<br/><div align=\"center\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td><b>Keyword</b></td><td><b>Occurrences</b></td></tr>"; for ($i = 0; $i <= 15; $i++) { $char = dechex($i); $result = mysql_query("select keyword, count(" . $mysql_table_prefix . "link_keyword{$char}.keyword_id) as x from " . $mysql_table_prefix . "keywords, " . $mysql_table_prefix . "link_keyword{$char} where " . $mysql_table_prefix . "keywords.keyword_id = " . $mysql_table_prefix . "link_keyword{$char}.keyword_id group by keyword order by x desc limit 30"); echo mysql_error(); while ($row = mysql_fetch_row($result)) { $topwords[$row[0]] = $row[1]; } } arsort($topwords); $count = 0; while ((list($word, $weight) = each($topwords)) && $count <= 30) { $count++; if ($class == "white") { $class = "grey"; } else { $class = "white"; } print "<tr class=\"{$class}\"><td align=\"left\">" . $word . "</td><td> " . $weight . "</td></tr>\n"; } print "</table></td></tr></table></div>"; } if ($type == 'pages') { $class = "grey"; ?> <br/><div align="center"> <table cellspacing ="0" cellpadding="0" class="darkgrey"><tr><td> <table cellpadding="2" cellspacing="1"> <tr class="grey"><td> <b>Page</b></td> <td><b>Text size</b></td></tr> <?php $result = mysql_query("select " . $mysql_table_prefix . "links.link_id, url, length(fulltxt) as x from " . $mysql_table_prefix . "links order by x desc limit 20"); echo mysql_error(); while ($row = mysql_fetch_row($result)) { if ($class == "white") { $class = "grey"; } else { $class = "white"; } $url = $row[1]; $sum = number_format($row[2] / 1024, 2); print "<tr class=\"{$class}\"><td align=\"left\"><a href=\"{$url}\">" . $url . "</td><td align= \"center\"> " . $sum . "kb</td></tr>"; } print "</table></td></tr></table></div>"; } if ($type == 'top_searches') { $class = "grey"; print "<br/><div align=\"center\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td><b>Query</b></td><td><b>Count</b></td><td><b> Average results</b></td><td><b>Last queried</b></td></tr>"; $result = mysql_query("select query, count(*) as c, date_format(max(time), '%Y-%m-%d %H:%i:%s'), avg(results) from " . $mysql_table_prefix . "query_log group by query order by c desc"); echo mysql_error(); while ($row = mysql_fetch_row($result)) { if ($class == "white") { $class = "grey"; } else { $class = "white"; } $word = $row[0]; $times = $row[1]; $date = $row[2]; $avg = number_format($row[3], 1); print "<tr class=\"{$class}\"><td align=\"left\">" . htmlentities($word) . "</td><td align=\"center\"> " . $times . "</td><td align=\"center\"> " . $avg . "</td><td align=\"center\"> " . $date . "</td></tr>"; } print "</table></td></tr></table></div>"; } if ($type == 'log') { $class = "grey"; print "<br/><div align=\"center\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td align=\"center\"><b>Query</b></td><td align=\"center\"><b>Results</b></td><td align=\"center\"><b>Queried at</b></td><td align=\"center\"><b>Time taken</b></td></tr>"; $result = mysql_query("select query, date_format(time, '%Y-%m-%d %H:%i:%s'), elapsed, results from " . $mysql_table_prefix . "query_log order by time desc"); echo mysql_error(); while ($row = mysql_fetch_row($result)) { if ($class == "white") { $class = "grey"; } else { $class = "white"; } $word = $row[0]; $time = $row[1]; $elapsed = $row[2]; $results = $row[3]; print "<tr class=\"{$class}\"><td align=\"left\">" . htmlentities($word) . "</td><td align=\"center\"> " . $results . "</td><td align=\"center\"> " . $time . "</td><td align=\"center\"> " . $elapsed . "</td></tr>"; } print "</table></td></tr></table></div>"; } if ($type == 'spidering_log') { $class = "grey"; $files = get_dir_contents($log_dir); if (count($files) > 0) { print "<br/><div align=\"center\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td align=\"center\"><b>File</b></td><td align=\"center\"><b>Time</b></td><td align=\"center\"><b></b></td></tr>"; for ($i = 0; $i < count($files); $i++) { $file = $files[$i]; $year = substr($file, 0, 2); $month = substr($file, 2, 2); $day = substr($file, 4, 2); $hour = substr($file, 6, 2); $minute = substr($file, 8, 2); if ($class == "white") { $class = "grey"; } else { $class = "white"; } print "<tr class=\"{$class}\"><td align=\"left\"><a href='{$log_dir}/{$file}' tareget='_blank'>{$file}</a></td><td align=\"center\"> 20{$year}-{$month}-{$day} {$hour}:{$minute}</td><td align=\"center\"> <a href='?f=delete_log&file={$file}' id='small_button'>Delete</a></td></tr>"; } print "</table></td></tr></table></div>"; } else { ?> <br/><br/> <center><b>No saved logs.</b></center> <?php } } }
.error {color: #FF0000;} </style> </head> <body> <img src="chews.png" alt="CHeWS Sample Image"> <h1>CHemical Element Word Solver (ChEWS)</h1> <?php ####################### # Database Statistics ####################### include 'database.php'; $stats = getStatistics(); $successWords = getWords(True); $failWords = getWords(False); echo "<h3> Database Contains " . $stats['success'] . " words with solutions</h3>"; $lastWord = ""; foreach ($successWords as $wordData) { if ($lastWord != "") { if (substr($lastWord, 0, 1) != substr($wordData[0], 0, 1)) { echo "<br/>"; } else { echo ", "; } } echo $wordData[0] . " (" . $wordData[1] . ")"; $lastWord = $wordData[0]; }
} else { $cmd = "Invalid command"; } $res = shell_exec("{$cmd} 2>&1"); setmsg(t('Response: ') . $res, 'notice'); break; case 'svn': if (!isadmin()) { setmsg(t('Permission Denied')); } $cmd = "svn up " . ZH; $msg = `{$cmd}`; setmsg("<pre>{$msg}</pre>", 'notice'); break; default: $user = $me; $group = $roles[$role]; if (isadmin()) { if ($_REQUEST['refresh'] == 1 || !isset($_SESSION['services'])) { $_SESSION['services'] = getServicesStatus(); } $services = $_SESSION['services']; } if (!isset($_SESSION['stats'])) { $_SESSION['stats'] = getStatistics(); } $stats = $_SESSION['stats']; break; } include template('index'); //echo human2bytes('10GB')/1024;
function statisticsForm($type) { echo "<div class='submenu y3'>\r\n\t\t\t\t<ul>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&type=keywords' title='Show list of Top 60 Keywords'>Top keywords</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&type=pages' title='Show list of Largest Pages and their indexed file size'>Largest pages</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&type=spidering_log' title='Show list of Spidering Logs'>Spidering logs</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&type=server_info' title='Show all available server info'>Server Info</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&type=log' title='Show Search Log activity'>Search log</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&type=top_searches' title='Show list of the most popular on-line Searches'>Most popular searches</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&type=top_links' title='Show list of the most popular links, clicked by the user'>Most popular links</a></li>\r\n\t\t\t\t</ul>\r\n\t\t\t</div>\r\n\t\t"; if ($type == "") { $cachedSumQuery = "select sum(length(fulltxt)) from " . TABLE_PREFIX . "links"; $result = mysql_query("select sum(length(fulltxt)) from " . TABLE_PREFIX . "links"); if (DEBUG > '0') { echo mysql_error(); } if ($row = mysql_fetch_array($result)) { $cachedSumSize = $row[0]; } $cachedSumSize = number_format($cachedSumSize / 1024, 2); $sitesSizeQuery = "select sum(size) from " . TABLE_PREFIX . "links"; $result = mysql_query("{$sitesSizeQuery}"); if (DEBUG > '0') { echo mysql_error(); } if ($row = mysql_fetch_array($result)) { $sitesSize = $row[0]; } $sitesSize = number_format($sitesSize, 2); $result = mysql_query("select count(*) from " . TABLE_PREFIX . "query_log"); if (DEBUG > '0') { echo mysql_error(); } if ($row = mysql_fetch_array($result)) { $query_tot = $row[0]; } $result = mysql_query("select sum(click_counter) from " . TABLE_PREFIX . "links"); if (!mysql_error()) { if ($row = mysql_fetch_array($result)) { $click_tot = $row[0]; } $stats = getStatistics(); echo "<div class='panel w60'>\r\n\t\t\t\t\t<dl class='tblhead'>\r\n\t\t\t\t\t\t<dt class='headline x2'>Overall Statistics:</dt><dd class='headline'> Details</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Sites:</dt><dd class='odrow'> " . $stats['sites'] . "</dd>\r\n\t\t\t\t\t\t<dt class='evrow bd x2'>Links:</dt><dd class='evrow'> " . $stats['links'] . "</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Categories:</dt><dd class='odrow'> " . $stats['categories'] . "</dd>\r\n\t\t\t\t\t\t<dt class='evrow bd x2'>Keywords:</dt><dd class='evrow'> " . $stats['keywords'] . "</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Keyword link-relations:</dt><dd class='odrow'> " . $stats['index'] . "</dd>\r\n\t\t\t\t\t\t<dt class='evrow bd x2'>Cached texts total:</dt><dd class='evrow'> {$cachedSumSize} kb</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Sites size total:</dt><dd class='odrow'> {$sitesSize} kb</dd>\r\n\t\t\t\t\t\t<dt class='evrow bd x2'>Queries total:</dt><dd class='evrow'> {$query_tot}</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Link clicks total:</dt><dd class='odrow'> {$click_tot}</dd>\r\n\t\t\t\t\t</dl>\r\n\t\t\t\t</div>\r\n\t\t\t\t"; } else { echo "\r\n\t\t\t\t\t<div class='submenu cntr'>\r\n\t\t\t\t\t<span class='warnadmin'>\r\n\t\t\t\t"; if (DEBUG > '0') { echo mysql_error(); } echo "<br /><br /><br />\r\n\t\t\t\t\tPlease run the .../admin/install_bestclick.php file.\r\n\t\t\t\t\t<b r />\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<br /><br />\r\n\t\t\t\t"; die; } exit; } if ($type == 'keywords') { $class = "evrow"; for ($i = 0; $i <= 15; $i++) { $char = dechex($i); $result = mysql_query("select keyword, count(" . TABLE_PREFIX . "link_keyword{$char}.keyword_id) as x from " . TABLE_PREFIX . "keywords, " . TABLE_PREFIX . "link_keyword{$char} where " . TABLE_PREFIX . "keywords.keyword_id = " . TABLE_PREFIX . "link_keyword{$char}.keyword_id group by keyword order by x desc limit 30"); if (DEBUG > '0') { echo mysql_error(); } while ($row = mysql_fetch_row($result)) { $topwords[$row[0]] = $row[1]; } } arsort($topwords); echo "<div class='panel'>\r\n\t\t\t\t<p class='headline cntr'>Top 60 Keywords</p>\r\n\t\t\t"; $nloops = 1; do { $nloops++; $count = 1; echo "<div class='ltfloat x3'>\r\n\t\t\t\t\t<dl>\r\n\t\t\t\t\t\t<dt class='headline x2'>Keyword</dt><dd class='headline'>: Instances</dd>\r\n\t\t\t\t"; while ((list($word, $weight) = each($topwords)) && $count < 21) { $word = quote_replace($word); $count++; if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } echo "<dt class='{$class}'><a href='../" . WEBROOT_DIR . "/admin/?query={$word}&search=1' target='rel' title='View search results in new window'>" . trim(substr($word, 0, 35)) . "</a></dt>\r\n\t\t\t\t\t\t<dd class='{$class}'>: " . $weight . "</dd>\r\n\t\t\t\t\t"; } echo "</dl>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t"; } while ($nloops <= 3); echo "<div class='clear'></div>\r\n\t\t\t\t\t<br />\r\n\t\t\t\t\t<a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n\t\t\t\t\t<br />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t"; exit; } if ($type == 'pages') { $class = "evrow"; echo "<div class='panel'>\r\n <dl class='tblhead'>\r\n <dt class='headline x8'>File Size</dt><dd class='headline cntr'>Links to Largest Pages</dd>\r\n "; $result = mysql_query("select " . TABLE_PREFIX . "links.link_id, url, length(fulltxt) as x from " . TABLE_PREFIX . "links order by x desc limit 20"); if (DEBUG > '0') { echo mysql_error(); } while ($row = mysql_fetch_row($result)) { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $url = $row[1]; $sum = number_format($row[2] / 1024, 2); echo "<dt class='{$class} x8'>" . $sum . "kb </dt>\r\n <dd class='{$class}'><a href='{$url}' title='Open this page in new window' target='_blank'>" . $url . "</a></dd>\r\n "; } echo "</dl>\r\n <br />\r\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a> \r\n <br />\r\n \r\n </div>\r\n "; exit; } if ($type == 'top_searches') { $class = "evrow"; echo "<div class='panel'>\r\n <p class='headline cntr'>Most Popular Searches (Top 50)</p>\r\n <table width='100%'>\r\n <tr>\r\n <td class='tblhead'>Query</td>\r\n <td class='tblhead'>Count</td>\r\n <td class='tblhead'>Average results</td>\r\n <td class='tblhead'>Last queried</td>\r\n </tr>\r\n "; $allthese = '1'; $result = mysql_query("select query, count(*) as c, date_format(max(time), '%Y-%m-%d %H:%i:%s'), avg(results) from " . TABLE_PREFIX . "query_log group by query order by c desc"); if (DEBUG > '0') { echo mysql_error(); } while (($row = mysql_fetch_row($result)) && $allthese <= '50') { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $word = $row[0]; $times = $row[1]; $date = $row[2]; $avg = number_format($row[3], 0); $word = str_replace("\"", "", $word); echo "<tr class='{$class} '>\r\n <td><a href='../" . WEBROOT_DIR . "/admin/?query={$word}&search=1' target='rel' title='View search results in new window'>" . $word . "</a></td>\r\n <td class='cntr'> " . $times . "</td>\r\n <td class='cntr'> " . $avg . "</td><td class='cntr'> " . $date . "</td>\r\n </tr>\r\n "; $allthese++; } echo "\r\n </table>\r\n <br />\r\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a> \r\n <br /> \r\n </div>\r\n "; exit; } if ($type == 'top_links') { $class = "evrow"; echo "<div class='panel'>\r\n <p class='headline cntr'>Most Popular Links (Top 50)</p>\r\n <table width='100%'>\r\n <tr>\r\n <td class='tblhead'>Link</td>\r\n <td class='tblhead'>Total clicks</td>\r\n <td class='tblhead'>Last clicked</td>\r\n <td class='tblhead'>Last query</td>\r\n </tr>\r\n "; $allthese = '1'; $result = mysql_query("select url, click_counter, last_click, last_query from " . TABLE_PREFIX . "links order by click_counter DESC, url"); if (DEBUG > '0') { echo mysql_error(); } while (($row = mysql_fetch_row($result)) && $allthese <= '50') { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $url = $row[0]; $click_counter = $row[1]; $Timestamp = $row[2]; $last_query = $row[3]; if ($Timestamp != '0') { $last_click = date("Y-m-d H:i:s", $Timestamp); echo "<tr class='{$class}'>\r\n <td><a href='{$url}' target='rel' title='View link in new window'>" . htmlentities($url) . "</a></td>\r\n <td class='cntr sml'> " . $click_counter . "</td>\r\n <td class='cntr sml'> " . $last_click . "</td>\r\n <td class='cntr sml'> " . $last_query . "</td>\r\n </tr>\r\n "; $allthese++; } } echo "\r\n </table>\r\n <br />\r\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a> \r\n <br /> \r\n </div>\r\n "; exit; } if ($type == 'log') { $class = "evrow"; echo "<div class='panel w75'>\r\n <p class='headline cntr'>Search Log (Latest 100)</p>\r\n <table width='100%'>\r\n <tr>\r\n <td class='tblhead'>Query</td>\r\n <td class='tblhead x6'>Results</td>\r\n <td class='tblhead x3'>Queried at:</td>\r\n <td class='tblhead x5'>Time taken</td>\r\n </tr>\r\n "; $num = '1'; $result = mysql_query("select query, date_format(time, '%Y-%m-%d %H:%i:%s'), elapsed, results from " . TABLE_PREFIX . "query_log order by time desc"); if (DEBUG > '0') { echo mysql_error(); } while (($row = mysql_fetch_row($result)) && $num <= '100') { if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } $word = $row[0]; $time = $row[1]; $elapsed = $row[2]; $results = $row[3]; echo "<tr class='{$class}'>\r\n <td><a href='../" . WEBROOT_DIR . "/admin/?query={$word}&search=1' target='rel' title='View search results in new window'>" . $word . "</a></td>\r\n <td class='cntr'> " . $results . "</td>\r\n <td class='cntr'> " . $time . "</td>\r\n <td class='cntr'> " . $elapsed . "</td>\r\n </tr>\r\n "; $num++; } echo "\r\n </table>\r\n <br />\r\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a> \r\n <br /> \r\n </div>\r\n "; exit; } if ($type == 'spidering_log') { $class = "evrow"; $files = get_dir_contents(LOG_DIR); if (count($files) > 0) { echo "<div class='panel w75'>\r\n <p class='headline cntr'>Spidering Logs</p>\r\n <form action='' id='fdelfm'>\r\n <table width='100%'>\r\n <tr>\r\n <td class='tblhead'>File</td>\r\n <td class='tblhead'>Created</td>\r\n <td class='tblhead' width='22%'>Option</td>\r\n </tr>\r\n <tr>\r\n <td colspan='3' class='odrow cntr bd'>\r\n <input type='hidden' name='f' value='44' />\r\n <input class='sbmt' id='submit1' type='submit' value='Delete ALL log files' title='Start Log File deletion' onclick=\"return confirm('Are you sure you want to delete ALL log files?')\" />\r\n </td>\r\n </tr>\r\n "; for ($i = 0; $i < count($files); $i++) { $file = $files[$i]; $year = substr($file, 0, 2); $month = substr($file, 2, 2); $day = substr($file, 4, 2); $hour = substr($file, 6, 2); $minute = substr($file, 8, 2); if ($class == "evrow") { $class = "odrow"; } else { $class = "evrow"; } echo "<tr class='{$class}'>\r\n <td class='cntr'>\r\n <a href='" . LOG_DIR . "/{$file}' target='_blank' title='Open this Log File in new window'>{$file}</a></td>\r\n "; if (strlen($file) > '13') { echo " <td class='cntr'>20{$year}-{$month}-{$day} {$hour}:{$minute}</td>\r\n <td class='cntr options'><a href='?f=delete_log&file={$file}' class='options' title='Click to Delete this Log File' onclick=\"return confirm('Are you sure you want to delete? {$file} Indexing Log File will be lost.')\">Delete</a></td>\r\n "; } else { echo " <td></td><td></td\r\n "; } echo "\r\n </tr>\r\n "; } echo "\r\n\t\t\t\t\t</table></form>\r\n\t\t\t\t\t<br />\r\n\t\t\t\t\t<a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n\t\t\t\t\t<br />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t"; } else { echo "<br />\r\n\t\t\t\t\t<p class='cntr msg'>Note: <span class='warnadmin'>No saved spidering logs exist!</span></p>\r\n\t\t\t\t\t<br /> <br />\r\n\t\t\t\t"; } exit; } if ($type = 'server_info') { $s_infos = $_SERVER; $e_infos = $_ENV; echo "<div class='submenu'>\r\n\t\t\t\t\t<ul>\r\n\t\t\t\t\t\t<li><a href='#serv_info'>Server</a></li>\r\n\t\t\t\t\t\t<li><a href='#en_info'>Environment</a></li>\r\n\t\t\t\t\t\t<li><a href='#mysql_info'>MySQL</a></li>\r\n\t\t\t\t\t\t<li><a href='#pdf_con'>PDF-converter</a></li>\r\n\t\t\t\t\t\t<li><a href='#php_ini'>php.ini file</a></li>\r\n\t\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=35'>PHP integration</a></li>\r\n\t\t\t\t\t\t<li><a href='#php_sec'>PHP security info</a></li>\r\n\t\t\t\t\t</ul>\r\n\t\t\t\t</div>\r\n\t\t\t\t<table width='98%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class='headline' colspan='6'>\r\n\t\t\t\t\t\t\t<div class='headline cntr'><a name='serv_info'>Server</a></span> </div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td width='20%' class='tblhead'>Key</td>\r\n\t\t\t\t\t\t<td class='tblhead'>Value</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t"; $bgcolor = 'odrow'; $i = 0; reset($s_info); while (list($key, $value) = each($s_infos)) { echo "<tr class='{$bgcolor} cntr'>\r\n\t\t\t\t\t\t<td>{$key}</td>\r\n\t\t\t\t\t\t<td class='bordl'>{$value}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t"; $i++; if ($bgcolor == 'odrow') { $bgcolor = 'evrow'; } else { $bgcolor = 'odrow'; } } echo "\r\n\t\t\t\t</table><br />\r\n\t\t\t\t<a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n\t\t\t\t<br /><br />\r\n\t\t\t\t<table width='98%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class='headline' colspan='6'>\r\n\t\t\t\t\t\t\t<div class='headline cntr'><a name='en_info'>Environment</a></span> </div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td width='20%' class='tblhead'>Key</td>\r\n\t\t\t\t\t\t<td class='tblhead'>Value</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t"; $bgcolor = 'odrow'; $i = 0; reset($e_info); while (list($key, $value) = each($e_infos)) { echo "<tr class='{$bgcolor} cntr'> \r\n <td>{$key}</td>\r\n <td class='bordl'>{$value}</td>\r\n </tr>\r\n "; $i++; if ($bgcolor == 'odrow') { $bgcolor = 'evrow'; } else { $bgcolor = 'odrow'; } } echo "\r\n </table><br />\r\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n "; $server_version = mysql_get_server_info(); $host_info = mysql_get_host_info(); $client_info = mysql_get_client_info(); $protocol_version = mysql_get_proto_info(); echo "<br /><br />\r\n \t<table width='98%'>\r\n \t<tr>\r\n \t\t<td class='headline' colspan='6'>\r\n \t\t<div class='headline cntr'><a name='mysql_info'>MySQL Info</a></span> </div>\r\n \t\t</td>\r\n \t</tr>\r\n \t<tr>\r\n \t<td width='35%' class='tblhead'>Key</td>\r\n \t<td class='tblhead'>Value</td>\r\n </tr>\r\n "; $bgcolor = 'odrow'; echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>MySQL Server version</td>\r\n <td class='bordl'>{$server_version}</td>\r\n </tr>\r\n "; $bgcolor = 'evrow'; echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Connection info</td>\r\n <td class='bordl'>{$host_info}</td>\r\n </tr>\r\n "; $bgcolor = 'odrow'; echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Client library info</td>\r\n <td class='bordl'>{$client_info}</td>\r\n </tr>\r\n "; $bgcolor = 'evrow'; echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>MySQL protocol version</td>\r\n <td class='bordl'>{$protocol_version}</td>\r\n </tr>\r\n "; $bgcolor = 'odrow'; echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Support for mysqli</td>\r\n <td class='bordl'>See below as part of your PHP installation</td>\r\n </tr>\r\n </table><br /> \r\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n "; $os = ''; $os = $_ENV['OS']; // not all shared hosting server will supply this info $admin_path = $_ENV['ORIG_PATH_TRANSLATED']; // that might work for shared hosting server $admin_file = $_SERVER['SCRIPT_FILENAME']; // should present the physical path $sdoc_root = $_SERVER['DOCUMENT_ROOT']; // this should provide every hoster (???) $edoc_root = $_ENV['DOCUMENT_ROOT']; // this should provide every hoster (???) echo "<br /><br />\r\n \t<table width='98%'>\r\n \t<tr>\r\n \t\t<td class='headline' colspan='6'>\r\n \t\t<div class='headline cntr'><a name='pdf_con'>PDF-converter relevant Info</a></span> </div>\r\n \t\t</td>\r\n \t</tr>\r\n \t<tr>\r\n \t<td width='35%' class='tblhead'>Key</td>\r\n \t<td class='tblhead'>Value</td>\r\n </tr>\r\n "; $bgcolor = 'odrow'; if ($os) { echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Operating System</td>\r\n <td class='bordl'>{$os}</td>\r\n </tr>\r\n "; $bgcolor = 'evrow'; } if (!$os) { $s_soft = $_SERVER['SERVER_SOFTWARE']; $sys_os = stripos($s_soft, "lin"); if (!$sys_os) { $sys_os = stripos($s_soft, "uni"); if (!$sys_os) { $sys_os = stripos($s_soft, "win"); } } if ($sys_os) { $os = substr($s_soft, $sys_os, '5'); echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Operating System</td>\r\n <td class='bordl'>{$os}</td>\r\n </tr>\r\n "; $bgcolor = 'evrow'; } else { $s_sig = $_SERVER['SERVER_SIGNATURE']; $sys_os = stripos($s_sig, "lin"); if (!$sys_os) { $sys_os = stripos($s_sig, "uni"); if (!$sys_os) { $sys_os = stripos($s_sig, "win"); } } } if ($sys_os) { $os = substr($s_sig, $sys_os, '5'); echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Operating System</td>\r\n <td class='bordl'>{$os}</td>\r\n </tr>\r\n "; $bgcolor = 'evrow'; } } // if ENV or SERVER_SIGNATURE or SERVER_SOFTWARE do not deliver OperatingSystem info, we will use the PHPinfo to extract it if (!$os) { $phpinfo = ''; ob_start(); // redirect output into buffer phpinfo(); $phpinfo = ob_get_contents(); // get all from phpinfo ob_end_clean(); // clean buffer and close it // extract OS information $start = stripos($phpinfo, "\"v\"") + 4; $end = stripos($phpinfo, "</td>", $start); $length = $end - $start; $os = substr($phpinfo, $start, $length); echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Operating System</td>\r\n <td class='bordl'>{$os}</td>\r\n </tr>\r\n "; $bgcolor = 'evrow'; } if ($admin_path) { $admin_path = str_replace("\\\\", "/", $admin_path); $admin_path = str_replace("\\", "/", $admin_path); $pdf_path = str_replace("admin/index.php", "converter/", $admin_path); echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Physical path to Sphider-plus Admin</td>\r\n <td class='bordl'>{$admin_path}</td>\r\n </tr> \r\n "; $bgcolor = 'odrow'; echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Physical path to the Linux / UNIX PDF-converter</td>\r\n <td class='bordl'>{$pdf_path}</td>\r\n </tr> \r\n "; $bgcolor = 'evrow'; } else { if ($admin_file) { $admin_file = str_replace("\\\\", "/", $admin_file); $admin_file = str_replace("\\", "/", $admin_file); $pdf_path = str_replace("admin/index.php", "converter/", $admin_file); echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Physical path to Sphider-plus Admin</td>\r\n <td class='bordl'>{$admin_file}</td>\r\n </tr>\r\n "; $bgcolor = 'odrow'; echo "\r\n <tr class='{$bgcolor} cntr'>\r\n <td>Physical path to the Linux / UNIX PDF-converter</td>\r\n <td class='bordl'>{$pdf_path}</td>\r\n </tr> \r\n "; $bgcolor = 'evrow'; } } if ($sdoc_root) { echo " \r\n <tr class='{$bgcolor} cntr'>\r\n <td>Physical path to document root</td>\r\n <td class='bordl'>{$sdoc_root}</td>\r\n </tr> \r\n "; } else { if ($edoc_root) { echo " \r\n <tr class='{$bgcolor} cntr'>\r\n <td>Physical path to document root</td>\r\n <td class='bordl'>{$edoc_root}</td>\r\n </tr> \r\n "; } } if (!$admin_path && !$admin_file) { if ($sdoc_root) { echo " \r\n <tr class='{$bgcolor} cntr'>\r\n <td>Physical path to document root</td>\r\n <td class='bordl'>{$sdoc_root}</td>\r\n </tr> \r\n "; } if ($edoc_root) { echo " \r\n <tr class='{$bgcolor} cntr'>\r\n <td>Physical path to document root</td>\r\n <td class='bordl'>{$edoc_root}</td>\r\n </tr> \r\n "; } else { echo "\r\n </table>\r\n \t<table width='98%'>\r\n \t<tr>\r\n <td>\r\n <span class='cntr warnadmin'><br />\r\n Attention: Your server does not deliver information about the physical path to Sphider-plus.<br />\r\n For LINUX and UNIX systems you will have to initialize the PDF converter manually.<br />\r\n For details see the file readme.pdf, chapter: PDF converter for Linux/UNIX systems.<br />\r\n <br /></span>\r\n </td>\r\n </tr>\r\n "; } } echo "\r\n </table><br />\r\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a><br /><br />\r\n "; echo " \r\n \t<table width='98%'>\r\n \t<tr>\r\n \t\t<td class='headline' colspan='6'>\r\n \t\t<div class='headline cntr'>PHP Info</span> </div>\r\n \t\t</td>\r\n \t</tr>\r\n </table>\r\n "; echo "<br />\r\n \t<table width='98%'>\r\n \t<tr>\r\n \t\t<td class='headline' colspan='6'>\r\n \t\t<div class='headline cntr'><a name='php_ini'>php.ini file</a></span> </div>\r\n \t\t</td>\r\n \t</tr>\r\n \t<tr>\r\n \t\t<td width='20%' class='tblhead'>Key</td>\r\n \t\t<td class='tblhead'>Value</td>\r\n\r\n \t</tr>\r\n \t"; $php_ini = ini_get_all(); $bgcolor = 'odrow'; $i = 0; reset($php_ini); while (list($key, $value) = each($php_ini)) { echo "<tr class='{$bgcolor} cntr'> \r\n <td>{$key}</td>\r\n <td class='bordl'>\r\n "; // print_r($value); "</td>\r\n </tr>\r\n "; $i++; if ($bgcolor == 'odrow') { $bgcolor = 'evrow'; } else { $bgcolor = 'odrow'; } } echo "\r\n </table>\r\n <br /><br />\r\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n <br /><br />\r\n \t<table width='98%'>\r\n \t<tr>\r\n \t\t<td class='headline' colspan='6'>\r\n \t\t<div class='headline cntr'><a name='php_sec'>PHP security info</a></span> </div>\r\n \t\t</td>\r\n \t</tr>\r\n \t<tr>\r\n \t\t<td width='20%' class='tblhead'></td>\r\n \t\t<td class='tblhead'></td>\r\n\r\n \t</tr>\r\n \t"; //phpsecinfo(); // get PHP security information echo "\r\n </table>\r\n <br /><br />\r\n <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n <br /><br />\r\n </div>\r\n "; exit; } }
function printParticipants() { global $preferences; global $userstartype; // statistics $statistics = getStatistics(); // return all participants, languages, and challenges $data = callStoredProcedure("GetGroupedEntries(" . $statistics['TotalPagesRead'] . "," . $statistics['TotalMinutesWatched'] . ")"); $lastusername = ""; $index = 0; $subindex = 0; $rowcount = mysqli_num_rows($data); $rowindex = 0; $infos = array(); while ($info = mysqli_fetch_array($data)) { array_push($infos, $info); } // first set up needed variables etc foreach ($infos as &$info) { // other stuff $username = $info['UserName']; $displayname = $info['DisplayName']; $minuteswatched = $info['MinutesWatched']; $pagesread = $info['PagesRead']; $books = round($pagesread / $preferences->BOOK_PAGES); $films = round($minuteswatched / $preferences->FILM_MINUTES); // figure out sort order $rowindex++; if ($username != $lastusername) { $subindex = 0; $index++; $lastusername = $username; } $subindex += 0.01; // stars, numbers, or blank? $info['FilmEntry'] = getTableEntry($films, $preferences->TARGET_FILMS, "films"); $info['BookEntry'] = getTableEntry($books, $preferences->TARGET_BOOKS, "books"); // calculate the star type across a number of entries //$userstartype[$username]->type = 0; // participant formatting $info['UserString'] = "<span class='username'><a href=participant.php?username="******">" . $displayname . "</a></span><br> <span class='twitter'>@<a href=http://twitter.com/" . $username . ">" . $username . "</a></span>"; $info['CustomKey'] = " sorttable_customkey='" . ($info['TotalUnits'] - $index - $subindex) . "'"; // unset the reference unset($info); } // print the headers print "<table class='sortable' id='participantstable'><tr class='merge'>\n <th id='thparticipant'>Participant</th>\n <th id='thstudying'>Studying</th>\n <th id='thwatched'>Watched</th>\n <th id='thread'>Read</th>\n <th id='thprogress'></th></tr>"; // and the table in random order! shuffle($infos); foreach ($infos as $info) { $filmentry = $info['FilmEntry']; $bookentry = $info['BookEntry']; //$startype = $startypes[$userstartype[$info['UserName']]->type]; //<div class='star $startype'></div> $filmstars = floor($filmentry->count / 25); $bookstars = floor($bookentry->count / 25); $stars = "<div class='star none'></div>"; $rank = $filmentry->count + $bookentry->count; $bluecount = 0; $newstars = getStarsHtml($filmstars, $bookstars, true, $rank, $bluecount) . getStarsHtml($bookstars, $filmstars, false, $rank, $bluecount); if ($newstars != "") { $stars = "<div class='star filler'></div>{$newstars}"; } $sprint = $info['LongestSprint']; $streak = $info['CurrentStreak']; $badges = getStreakDiv($streak, 5, 10, 20); $badges .= getSprintDiv($sprint); print "<tr>\n <td class='show'" . $info['CustomKey'] . ">" . $info['UserString'] . "</td>\n <td class=''>" . $info['LanguageName'] . "</td>\n <td sorttable_customkey='{$filmentry->count}'>{$filmentry->content}</td>\n <td sorttable_customkey='{$bookentry->count}'>{$bookentry->content}</td>\n <td sorttable_customkey='{$rank}' class='stars'>{$stars}{$badges}</td></tr>"; } // the footer print "</table>"; }
if (getOverallState($session, "Businessrules")) { } // Components catalogs counters if (getOverallState($session, "Componentscatalog")) { } // Services counters if (getOverallState($session, "Ressources")) { } // Hosts states (no filter, 100 record from first) if (getHostsStates($session, '', 0, 1)) { } // Services states (no filter, 100 record from first) if (getServicesStates($session, '', 0, 1)) { } // All counters if (getCounters($session)) { } // Last counters per each host if (getCounters($session, true)) { } // Sum of daily printed pages per host if (getStatistics($session, 'sum', 'hostname', 'hostname ASC')) { } // Sum of daily printed pages per entity ... if (getStatistics($session, 'sum', '`glpi_entities`.`name`', '`glpi_entities`.`name` ASC')) { } // ... ordered by printed pages total ascending. if (getStatistics($session, 'sum', '`glpi_entities`.`name`', '`sum_cPagesToday` ASC')) { } // Logout logout();
} } else { $cron_logs[] = $message; } } else { if ($message !== false) { log_cron_action($message, $nextitem); } } } // ######################################################################## // ######################### START MAIN SCRIPT ############################ // ######################################################################## $vbulletin->db->hide_errors(); //Get statistics $money = getStatistics(true); $log = array('type' => KBANK_LOGTYPE_STAT, 'userid' => 0, 'timeline' => TIMENOW, 'text1' => '', 'int1' => $money['member'], 'detail' => serialize($money)); $vbulletin->db->query_write(fetch_query_sql($log, 'kbank_logs')); // log the cron action kbank_log_cron_action('Cached kBank Information'); //Any KBANK_ITEM_USED_WAITING items? $items = $vbulletin->db->query_read("\n\tSELECT *\n\tFROM `" . TABLE_PREFIX . "kbank_items` AS items\n\tWHERE items.status = " . KBANK_ITEM_USED_WAITING . "\n\t\tAND items.expire_time <= " . TIMENOW . "\n\t\t\tAND items.expire_time > 0\n"); if (!$vbulletin->kbank_itemtypes) { $vbulletin->kbank_itemtypes = updateItemTypeCache(); } if ($vbulletin->db->num_rows($items)) { $itemids = array(); while ($itemdata = $vbulletin->db->fetch_array($items)) { if ($item =& newItem($itemdata['itemid'], $itemdata)) { if ($status = $item->doAction('work_expired')) { $itemids[] = "#{$itemdata['itemid']} ({$status})";
print_submit_row("View Logs", 0); print_form_header('kbankadmin', 'do_ban'); print_table_header('Ban Member From Actions (<a href="kbankadmin.php?' . $vbulletin->session->vars['sessionurl'] . 'do=view_banned">View banned Members</a>)'); print_input_row("Username", 'username', ''); print_input_row("Days", 'day', ''); print_input_row("Reason", 'reason', ''); print_submit_row("Ban Member", 0); print_table_footer(); print_cp_footer(); } // ###################### Bank Management - Stat View ######################## if ($_GET['do'] == "stat") { $processed = true; print_cp_header("kBank Management - {$vbphrase['kbank_banklogs_stat']}"); $vbulletin->input->clean_array_gpc('r', array('limit' => TYPE_UINT, 'before' => TYPE_UINT, 'after' => TYPE_UINT)); $recs = getStatistics(false, iif($vbulletin->GPC['limit'], $vbulletin->GPC['limit'], PERPAGE_DEFAULT), iif($vbulletin->GPC['before'], $vbulletin->GPC['before'], false), iif($vbulletin->GPC['after'], $vbulletin->GPC['after'], false)); print_table_start(); print_table_header('<a name="system"></a>' . $vbphrase['kbank_banklogs_stat'], 4); $headings = array(); $headings[] = 'Timeline'; $headings[] = 'Total'; $headings[] = 'Member'; $headings[] = 'InStock'; print_cells_row($headings, 1); $first_timeline = $last_timeline = 0; if (is_array($recs)) { foreach ($recs as $timeline => $rec) { $cell = array(); $cell[] = vbdate($vbulletin->options['timeformat'] . ' ' . $vbulletin->options['dateformat'], $timeline); $cell[] = vb_number_format($rec['total']); $cell[] = vb_number_format($rec['member']);
<?php require_once "functions.php"; $statistics_array = getStatistics(); $packed = $statistics_array[0]->packed; $unpacked = $statistics_array[0]->unpacked; $orders = $packed + $unpacked; ?> <html> <body> <h3>Tellimusi kokku: <?php echo $orders; ?> </h3> <h3>Pakitud: <?php echo $packed; ?> </h3> <h3>Pakkimata: <?php echo $unpacked; ?> </h3> </body> </html>
function getDefaultCenterPanel($mapping) { $ctx = Model_Context::getInstance(); $blogid = $ctx->getProperty('blog.id'); ?> <div id="<?php echo $mapping['plugin']; ?> " class="section"> <h3 class="caption<?php echo isset($_REQUEST['edit']) ? ' visible' : ' invisible'; ?> "> <span><?php echo _t('알림판'); if (isset($_REQUEST['edit'])) { ?> <a id="<?php echo $mapping['plugin']; ?> dojoup" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard?edit&pos=<?php echo $positionCounter; ?> &rel=-1&edit"><?php echo _t("위로"); ?> </a> <a id="<?php echo $mapping['plugin']; ?> dojodown" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard?edit&pos=<?php echo $positionCounter; ?> &rel=1&edit"><?php echo _t("아래로"); ?> </a> <?php } ?> </span> </h3> <?php if (isset($_REQUEST['edit'])) { ?> </div> <?php return true; } else { // Get default data $stats = getStatistics($blogid); $latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0); $comments = getRecentComments($blogid, 10); $guestbooks = getRecentGuestbook($blogid, 10); list($commentNotifies, $paging) = getCommentsNotifiedWithPagingForOwner($blogid, 0, null, null, null, 1, 10); $trackbacks = getRecentTrackbacks($blogid, 10); $recents = array(); // title, date, link, category foreach ($comments as $comment) { array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $comment['entry'] . "#comment" . $comment['id'], 'category' => 'comment')); } foreach ($commentNotifies as $comment) { array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/owner/communication/notify", 'category' => 'commentNotify')); } foreach ($guestbooks as $guestbook) { array_push($recents, array('title' => $guestbook['comment'], 'date' => $guestbook['written'], 'link' => $ctx->getProperty('uri.blog') . "/guestbook/" . $guestbook['id'] . "#guestbook" . $guestbook['id'], 'category' => 'guestbook')); } foreach ($trackbacks as $trackback) { array_push($recents, array('title' => $trackback['subject'], 'date' => $trackback['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $trackback['entry'] . "#trackback" . $trackback['id'], 'category' => 'trackback')); } $sort_array = array(); foreach ($recents as $uniqid => $row) { // Sorting. foreach ($row as $key => $value) { if (!array_key_exists($key, $sort_array)) { $sort_array[$key] = array(); } $sort_array[$key][$uniqid] = $value; } } if (!empty($sort_array)) { array_multisort($sort_array['date'], SORT_DESC, $recents); } $recents = array_slice($recents, 0, 14); ?> <div id="shortcut-collection"> <h4 class="caption"><span><?php echo _t('바로가기'); ?> </span></h4> <ul> <li class="newPost"><a class="newPost" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/entry/post"><span><?php echo _t('새 글 쓰기'); ?> </span></a></li> <?php if ($latestEntryId !== 0) { $latestEntry = getEntry($blogid, $latestEntryId); if (!is_null($latestEntry)) { ?> <li class="modifyPost"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/entry/edit/<?php echo $latestEntry['id']; ?> "><?php echo _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))); ?> </a></li> <?php } } if ($ctx->getProperty('service.reader') == true) { ?> <li class="rssReader"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/network/reader"><?php echo _t('RSS로 등록한 이웃 글 보기'); ?> </a></li> <?php } if (Acl::check("group.administrators")) { ?> <li class="deleteCache"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard/cleanup" onclick="cleanupCache();return false;"><?php echo _t('캐시 지우기'); ?> </a></li> <?php if (Acl::check("group.creators")) { ?> <li class="optimizeStorage"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/data" onclick="optimizeData();return false;"><?php echo _t('저장소 최적화'); ?> </a></li> <?php } } ?> <li class="clear"></li> </ul> </div> <div id="total-information"> <h4 class="caption"><span><?php echo _t('요약'); ?> </span></h4> <table class="posts-line"> <caption><?php echo _t('글'); ?> </caption> <thead> <th>type</th> <th>sum</th> </thead> <tbody> <tr> <td class="type"><?php echo _t('글'); ?> </td> <td class="sum"><?php echo number_format(getEntriesTotalCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('댓글'); ?> </td> <td class="sum"><?php echo number_format(getCommentCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('방명록'); ?> </td> <td class="sum"><?php echo number_format(getGuestbookCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('걸린 글'); ?> </td> <td class="sum"><?php echo number_format(getTrackbackCount($blogid)); ?> </td> </tr> </tbody> </table> <table class="visitors-line"> <caption><?php echo _t('방문자'); ?> </caption> <thead> <th>type</th> <th>sum</th> </thead> <tbody> <tr> <td class="type"><?php echo _t('오늘'); ?> </td> <td class="sum"><?php echo number_format($stats['today']); ?> </td> </tr> <tr> <td class="type"><?php echo _t('어제'); ?> </td> <td class="sum"><?php echo number_format($stats['yesterday']); ?> </td> </tr> <tr> <td class="type"><?php echo _t('7일 평균'); ?> </td> <td class="sum"><?php $weekly = Statistics::getWeeklyStatistics(); $weeklycount = 0; foreach ($weekly as $day) { $weeklycount += $day['visits']; } echo number_format($weeklycount / 7); unset($weekly); unset($weeklycount); ?> </td> </tr> <tr> <td class="type"><?php echo _t('총방문자'); ?> </td> <td class="sum"><?php echo number_format($stats['total']); ?> </td> </tr> </tbody> </table> </div> <div id="myBlogInfo"> <h4 class="caption"><span><a href="<?php echo $ctx->getProperty('uri.blog') . '/owner/communication/comment'; ?> "><?php echo _t('알림판'); ?> </a></span></h4> <table class="recent"> <caption>asdasd</caption> <thead> <tr> <th scope="col" class="date"><?php echo _t('날짜'); ?> </th> <th scope="col" class="category"><?php echo _t('종류'); ?> </th> <th scope="col"><?php echo _t('내용'); ?> </th> </tr> </thead> <tbody> <?php foreach ($recents as $item) { ?> <tr class="<?php echo $item['category']; ?> "> <td class="date"><?php echo Timestamp::format('%m/%d', $item['date']); ?> </td> <td class="category"> <?php switch ($item['category']) { case 'trackback': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/trackback?status=received">' . _t('걸린글') . '</a>'; break; case 'comment': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=comment">' . _t('댓글') . '</a>'; break; case 'commentNotify': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/notify">' . _t('알리미') . '</a>'; break; case 'guestbook': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=guestbook">' . _t('방명록') . '</a>'; break; } ?> </td> <td class="title"><a href="<?php echo $item['link']; ?> "><?php echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 20)); ?> </a></td> </tr> <?php } ?> </tbody> </table> </div> <?php $noticeURL = TEXTCUBE_NOTICE_URL; $noticeURLRSS = $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko") . "/rss"; $noticeEntries = array(); if (!is_null(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language')))) { $noticeEntries = unserialize(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'))); } else { list($result, $feed, $xml) = getRemoteFeed($noticeURLRSS); if ($result == 0) { $xmls = new XMLStruct(); $xmls->setXPathBaseIndex(1); $noticeEntries = array(); if ($xmls->open($xml, $ctx->getProperty('service.encoding'))) { if ($xmls->getAttribute('/rss', 'version')) { for ($i = 1; $link = $xmls->getValue("/rss/channel/item[{$i}]/link"); $i++) { $item = array('permalink' => rawurldecode($link)); $item['title'] = $xmls->getValue("/rss/channel/item[{$i}]/title"); if ($xmls->getValue("/rss/channel/item[{$i}]/pubDate")) { $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/pubDate")); } else { if ($xmls->getValue("/rss/channel/item[{$i}]/dc:date")) { $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/dc:date")); } else { $item['written'] = 0; } } array_push($noticeEntries, $item); } } } Setting::setServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'), serialize($noticeEntries)); } } ?> <div id="textcube-notice"> <h4 class="caption"><span><a href="<?php echo $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko"); ?> "><?php echo _t('공지사항'); ?> </a></span></h4> <?php if (count($noticeEntries) > 0) { array_splice($noticeEntries, 3, count($noticeEntries) - 3); ?> <table> <tbody> <?php foreach ($noticeEntries as $item) { ?> <tr> <td class="date"><?php echo Timestamp::format2($item['written']); ?> </td> <td class="title"><a href="<?php echo $item['permalink']; ?> " onclick="return openLinkInNewWindow(this);" ><?php echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 35)); ?> </a></td> </tr> <?php } ?> </tbody> </table> <?php } else { ?> <div id="fail-notice"> <?php echo _t('공지사항을 가져올 수 없습니다. 잠시 후 다시 시도해 주십시오.'); ?> </div> <?php } ?> </div> <?php } ?> </div> <?php }
function statisticsForm($type) { global $mysql_table_prefix, $log_dir; ?> <div id='submenu'> <ul> <li><a href="admin.php?f=statistics&type=keywords">关键词排行</a></li> <li><a href="admin.php?f=statistics&type=pages">最大页面</a></li> <li><a href="admin.php?f=statistics&type=top_searches">热门搜索</a></li> <li><a href="admin.php?f=statistics&type=log">搜索日志</a></li> <li><a href="admin.php?f=statistics&type=spidering_log">蜘蛛日志</a></li> </ul> </div> <?php if ($type == "") { $cachedSumQuery = "select sum(length(fulltxt)) from " . $mysql_table_prefix . "links"; $result = mysql_query("select sum(length(fulltxt)) from " . $mysql_table_prefix . "links"); echo mysql_error(); if ($row = mysql_fetch_array($result)) { $cachedSumSize = $row[0]; } $cachedSumSize = number_format($cachedSumSize / 1024, 2); $sitesSizeQuery = "select sum(size) from " . $mysql_table_prefix . "links"; $result = mysql_query("{$sitesSizeQuery}"); echo mysql_error(); if ($row = mysql_fetch_array($result)) { $sitesSize = $row[0]; } $sitesSize = number_format($sitesSize, 2); $stats = getStatistics(); print "<div id=\"details\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td><b>站点:</b></td><td align=\"center\">" . $stats['sites'] . "</td></tr>"; print "<tr class=\"white\"><td><b>链接:</b></td><td align=\"center\"> " . $stats['links'] . "</td></tr>"; print "<tr class=\"grey\"><td><b>分类:</b></td><td align=\"center\"> " . $stats['categories'] . "</td></tr>"; print "<tr class=\"white\"><td><b>关键词:</b></td><td align=\"center\"> " . $stats['keywords'] . "</td></tr>"; print "<tr class=\"grey\"><td><b>关键词关联链接:</b></td><td align=\"center\"> " . $stats['index'] . "</td></tr>"; print "<tr class=\"white\"><td><b>文本缓存总计:</b></td><td align=\"center\"> {$cachedSumSize} kb</td></tr>"; print "<tr class=\"grey\"><td><b>站点总数:</b></td><td align=\"center\"> {$sitesSize} kb</td></tr>"; print "</table></td></tr></table></div>"; } if ($type == 'keywords') { $class = "grey"; print "<div id=\"details\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td><b>关键词</b></td><td><b>关联</b></td></tr>"; for ($i = 0; $i <= 15; $i++) { $char = dechex($i); $result = mysql_query("select keyword, count(" . $mysql_table_prefix . "link_keyword{$char}.keyword_id) as x from " . $mysql_table_prefix . "keywords, " . $mysql_table_prefix . "link_keyword{$char} where " . $mysql_table_prefix . "keywords.keyword_id = " . $mysql_table_prefix . "link_keyword{$char}.keyword_id group by keyword order by x desc limit 30"); echo mysql_error(); while ($row = mysql_fetch_row($result)) { $topwords[$row[0]] = $row[1]; } } arsort($topwords); $count = 0; while ((list($word, $weight) = each($topwords)) && $count <= 30) { $count++; if ($class == "white") { $class = "grey"; } else { $class = "white"; } print "<tr class=\"{$class}\"><td align=\"left\">" . $word . "</td><td> " . $weight . "</td></tr>\n"; } print "</table></td></tr></table></div>"; } if ($type == 'pages') { $class = "grey"; ?> <div id="details"> <table cellspacing ="0" cellpadding="0" class="darkgrey"><tr><td> <table cellpadding="2" cellspacing="1"> <tr class="grey"><td> <b>页面</b></td> <td><b>文本尺寸</b></td></tr> <?php $result = mysql_query("select " . $mysql_table_prefix . "links.link_id, url, length(fulltxt) as x from " . $mysql_table_prefix . "links order by x desc limit 20"); echo mysql_error(); while ($row = mysql_fetch_row($result)) { if ($class == "white") { $class = "grey"; } else { $class = "white"; } $url = $row[1]; $sum = number_format($row[2] / 1024, 2); print "<tr class=\"{$class}\"><td align=\"left\"><a href=\"{$url}\">" . $url . "</td><td align= \"center\"> " . $sum . "kb</td></tr>"; } print "</table></td></tr></table></div>"; } if ($type == 'top_searches') { $class = "grey"; print "<div id=\"details\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td><b>查询</b></td><td><b>计数</b></td><td><b> 平均结果</b></td><td><b>最后查询</b></td></tr>"; $result = mysql_query("select query, count(*) as c, date_format(max(time), '%Y-%m-%d %H:%i:%s'), avg(results) from " . $mysql_table_prefix . "query_log group by query order by c desc"); echo mysql_error(); while ($row = mysql_fetch_row($result)) { if ($class == "white") { $class = "grey"; } else { $class = "white"; } $word = $row[0]; $times = $row[1]; $date = $row[2]; $avg = number_format($row[3], 1); print "<tr class=\"{$class}\"><td align=\"left\">" . htmlspecialchars($word) . "</td><td align=\"center\"> " . $times . "</td><td align=\"center\"> " . $avg . "</td><td align=\"center\"> " . $date . "</td></tr>"; } print "</table></td></tr></table></div>"; } if ($type == 'log') { $class = "grey"; print "<div id=\"details\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td align=\"center\"><b>查询</b></td><td align=\"center\"><b>结果</b></td><td align=\"center\"><b>查询时间</b></td><td align=\"center\"><b>所需时间</b></td></tr>"; $result = mysql_query("select query, date_format(time, '%Y-%m-%d %H:%i:%s'), elapsed, results from " . $mysql_table_prefix . "query_log order by time desc"); echo mysql_error(); while ($row = mysql_fetch_row($result)) { if ($class == "white") { $class = "grey"; } else { $class = "white"; } $word = $row[0]; $time = $row[1]; $elapsed = $row[2]; $results = $row[3]; print "<tr class=\"{$class}\"><td align=\"left\">" . htmlspecialchars($word) . "</td><td align=\"center\"> " . $results . "</td><td align=\"center\"> " . $time . "</td><td align=\"center\"> " . $elapsed . "</td></tr>"; } print "</table></td></tr></table></div>"; } if ($type == 'spidering_log') { $class = "grey"; $files = get_dir_contents($log_dir); if (count($files) > 0) { print "<div id=\"details\"><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\"><tr><td><table cellpadding=\"3\" cellspacing = \"1\"><tr class=\"grey\"><td align=\"center\"><b>文件</b></td><td align=\"center\"><b>时间</b></td><td align=\"center\"><b></b></td></tr>"; for ($i = 0; $i < count($files); $i++) { $file = $files[$i]; $year = substr($file, 0, 2); $month = substr($file, 2, 2); $day = substr($file, 4, 2); $hour = substr($file, 6, 2); $minute = substr($file, 8, 2); if ($class == "white") { $class = "grey"; } else { $class = "white"; } print "<tr class=\"{$class}\"><td align=\"left\"><a href='{$log_dir}/{$file}' tareget='_blank'>{$file}</a></td><td align=\"center\"> 20{$year}-{$month}-{$day} {$hour}:{$minute}</td><td align=\"center\"> <a href='?f=delete_log&file={$file}' id='small_button'>删除</a></td></tr>"; } print "</table></td></tr></table></div>"; } else { ?> <br/><br/> <center><b>没有日志。</b></center> <?php } } }
$relationship = str_replace('\\"', '"', $_GET['relation']); $log = fopen("/projects/wordseer/logs/query.log", "a"); $data = 'gov=' . $gov . ' dep=' . $dep . ' relation=' . $relation . ' '; fwrite($log, $data); fclose($log); $count = 0; $sentence_dependencies = array(); $govs = wordIDList($gov); $deps = wordIDList($dep); $rels = relationshipIDList($relationship); $dependency_ids = getDependencyIDs($govs, $deps, $rels, $withinNarrative, $withinSentence, $within, true); $count = mysql_num_rows($dependency_ids); // print out graph data in JSON format if ($count > 0) { //printStatistics(old_getStatistics($dependency_ids)); printStatistics(getStatistics($deps, $govs, $rels)); mysql_data_seek($dependency_ids, 0); } //print out search results if ($count > 0) { echo '<h3 class="num-results">' . $count; if ($count == 1) { echo ' result'; } else { if ($count < $pageLength) { echo ' results'; } else { echo ' results, ' . $pageLength . ' results per page, page ' . strval(intval($page) + 1) . ' of ' . strval(intval($count / $pageLength) + 1) . ' '; } } echo '</h3>';
} else { header('location: /statistics'); exit; } if ($_SESSION['statsorder'] != $orderby) { $_SESSION['statsorder'] = $orderby; if (setStatisticsOrder($_SESSION['userid'], $orderby)) { setInfo('Sortierreihenfolge wurde gespeichert!'); } else { setError('Fehler beim speichern der Sortierreihenfolge!'); } header("location: {$SETTINGS['url']}/statistics"); exit; } } $stats = getStatistics($orderby); if ($stats === false) { setError('Fehler beim laden der Statistik!'); } $tablebody = ''; foreach ($stats as $user) { $username = htmlspecialchars($user->username, 0, 'UTF-8'); $lastname = htmlspecialchars($user->lastname, 0, 'UTF-8'); $group = getRoleName($user->group); $userid = $user->id; $ratio = intval($user->ratio); $name = $username; $extra = ''; if ($isAdmin) { $name = "<a href=\"{$SETTINGS['path']}/user/{$userid}\">{$name}</a>"; $extra = "<td>{$group}</td>";