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 = $result->fetch_array(MYSQLI_NUM); $catidx = $res[0]; if ($catidx) { // build complete query for cat search $catlink = "<a href=\"{$search_script}?query={$query}&start={$prev}&search=1&category={$catidx}&catid={$catidx}&mark={$mark}&results={$results_per_page}&db={$db}&prefix={$prefix}&client_ip={$client_ip}&domain={$domain}\">{$value}</a>"; $catlinks[] = $catlink; } } $cat_links = implode(", ", $catlinks); } $urlx = reconvert_url($urlx); // recover blank characters $file = ''; // prepare the webshot thumbnails for result listing if ($shot) { $file = "" . $shot_dir . "/webshot" . $n . ".png"; if (!($handle = fopen($file, "ab"))) { if ($debug_user == '1') { print "Unable to open {$file} "; } } if (!fwrite($handle, $shot)) { if ($debug_user == '1') { print "Unable to write the file {$file}. No thumbnails will be presented"; } }
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; } }