This blob has been accessed 252 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- error_reporting(E_ERROR);
- if (get_magic_quotes_gpc()) {
- function stripslashes_array($data) {
- if (is_array($data)){
- foreach ($data as $key => $value){
- $data[$key] = stripslashes_array($value);
- }
- return $data;
- }
- else{
- return stripslashes($data);
- }
- }
- $_POST = stripslashes_array($_POST);
- }
- if (file_exists("data/offset.txt")) {
- $offset = file_get_contents("data/offset.txt");
- }
- else {
- $offset = 0;
- }
- ?>
- <title>Dig!</title>
- <style>
- body {
- color: #666666;
- margin: 10px;
- padding: 0px;
- text-align: left;
- font-family: <?php
- if (file_exists("data/fonts/body.txt")) {
- $font_body = file_get_contents("data/fonts/body.txt");
- echo "{$font_body},";
- }
- ?> arial, helvetica, sans-serif;
- background-color: #FFFFFF;
- }
- p {
- font-size: 11px;
- }
- a {
- font-weight: bold;
- text-decoration: none;
- }
- a:link, a:visited {
- color: #666666;
- }
- a:hover {
- color: #336699;
- }
- a:active {
- color: #336699;
- }
- </style>
- <?php
- $username_file = 'data/username.txt';
- if (!isset($_POST['search'])) {
- }
- if (empty($_POST['search'])) {
- echo "<p>Search string required. Click <a href=index.php>here</a> to go to the index page.</p>";
- }
- $search = trim(strip_tags(strtolower($_POST['search'])));
- $google = str_replace(" ", "+", $search);
- echo "<p>Search string must be composed of 3 or more characters. Click <a href=index.php>here</a> to go to the index page.</p>";
- }
- $dir = "data/items";
- if (file_exists("data/bb.txt") and file_exists("data/members/active") and ($dh_search_members = opendir("data/members/active"))) {
- $start_time_member = round(microtime(), 3);
- while (($entry_search_members = readdir($dh_search_members)) !== false) {
- if ($entry_search_members != "." && $entry_search_members != "..") {
- $total_members[] = $entry_search_members;
- }
- if ($entry_search_members != "." && $entry_search_members != ".." && (preg_match("/\b$search\b/i", file_get_contents("data/members/active/$entry_search_members/firstname.txt")) or preg_match("/\b$search\b/i", file_get_contents("data/members/active/$entry_search_members/lastname.txt")) or preg_match("/\b$search\b/i", file_get_contents("data/members/active/$entry_search_members/rank.txt")) or ($search == $entry_search_members))) {
- $show_search_members[] = $entry_search_members;
- }
- }
- $stop_time_member = round(microtime(), 3);
- $generation_time_member = $stop_time_member - $start_time_member;
- $generation_time_member = str_replace("-","",$generation_time_member);
- $show_search_members = array_unique($show_search_members);
- $show_search_members = array_values($show_search_members);
- sort($show_search_members);
- reset($show_search_members);
- $count_search_members = count($show_search_members);
- reset($total_members);
- $count_total_members = count($total_members);
- if ($count_search_members > 0) {
- echo "<p>Found <b>$search</b> in $count_search_members out of $count_total_members ";
- if ($count_total_members == 1) {
- echo "member";
- }
- if ($count_total_members > 1) {
- echo "members";
- }
- echo " ($generation_time_member seconds).</p>";
- $search_ucfirst = ucfirst($search);
- $search_ucwords = ucwords($search);
- $search_strtoupper = strtoupper($search);
- foreach ($show_search_members as $match_member) {
- $match_member_firstname = file_get_contents("data/members/active/$match_member/firstname.txt");
- $match_member_firstname = str_replace($search, "<span style=\"background-color: #ffff00;\">$search</span>", $match_member_firstname);
- $match_member_firstname = str_replace($search_ucfirst, "<span style=\"background-color: #ffff00;\">$search_ucfirst</span>", $match_member_firstname);
- $match_member_firstname = str_replace($search_ucwords, "<span style=\"background-color: #ffff00;\">$search_ucwords</span>", $match_member_firstname);
- $match_member_firstname = str_replace($search_strtoupper, "<span style=\"background-color: #ffff00;\">$search_strtoupper</span>", $match_member_firstname);
- $match_member_lastname = file_get_contents("data/members/active/$match_member/lastname.txt");
- $match_member_lastname = str_replace($search, "<span style=\"background-color: #ffff00;\">$search</span>", $match_member_lastname);
- $match_member_lastname = str_replace($search_ucfirst, "<span style=\"background-color: #ffff00;\">$search_ucfirst</span>", $match_member_lastname);
- $match_member_lastname = str_replace($search_ucwords, "<span style=\"background-color: #ffff00;\">$search_ucwords</span>", $match_member_lastname);
- $match_member_lastname = str_replace($search_strtoupper, "<span style=\"background-color: #ffff00;\">$search_strtoupper</span>", $match_member_lastname);
- $match_member_link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/member.php?id={$match_member}";
- $match_member_link_fix = array('//member.php', '///member.php');
- $match_member_link = str_replace($match_member_link_fix, '/member.php', $match_member_link);
- $match_member_link = trim($match_member_link);
- echo "<p><a href=member.php?id={$match_member}>$match_member</a><br>{$match_member_firstname} {$match_member_lastname}<br>$match_member_link</p>";
- }
- }
- }
- if ($dh_search_items = opendir($dir)) {
- $start_time_item = round(microtime(), 3);
- while (($entry_search_items = readdir($dh_search_items)) !== false) {
- if (($entry_search_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
- continue;
- }
- $cat_dir = file_get_contents("data/items/$entry_search_items/category.txt");
- if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_search_items/cat.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
- continue;
- }
- if (file_exists("data/items/$entry_search_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
- continue;
- }
- if (file_exists("data/items/$entry_search_items/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
- continue;
- }
- if (file_exists("data/items/$entry_search_items/member.txt") and !isset($_SESSION['logged_in'])) {
- continue;
- }
- if ($entry_search_items != "." && $entry_search_items != "..") {
- $total_entries[] = $entry_search_items;
- }
- if ($entry_search_items != "." && $entry_search_items != ".." && (preg_match("/\b$search\b/i", file_get_contents("data/items/$entry_search_items/title.txt")) or preg_match("/\b$search\b/i", file_get_contents("data/items/$entry_search_items/body.txt")))) {
- $show_search_items[] = $entry_search_items;
- }
- if ($entry_search_items != "." && $entry_search_items != ".." && file_exists("data/items/$entry_search_items/comments/live")) {
- if ($dh_comment_items = opendir("data/items/$entry_search_items/comments/live")) {
- while (($entry_comment_items = readdir($dh_comment_items)) !== false) {
- if ($entry_comment_items != "." && $entry_comment_items != "..") {
- $total_comments[] = $entry_comment_items;
- }
- if ($entry_comment_items != "." && $entry_comment_items != ".." && preg_match("/\b$search\b/i", file_get_contents("data/items/$entry_search_items/comments/live/$entry_comment_items/comment.txt"))) {
- $show_search_items[] = $entry_search_items;
- }
- }
- }
- }
- }
- closedir($dh_search_items);
- }
- $stop_time_item = round(microtime(), 3);
- $generation_time_item = $stop_time_item - $start_time_item;
- $generation_time_item = str_replace("-","",$generation_time_item);
- $show_search_items = array_unique($show_search_items);
- $show_search_items = array_values($show_search_items);
- rsort($show_search_items);
- reset($show_search_items);
- $count_search_items = count($show_search_items);
- reset($count_total_comments);
- $count_total_comments = count($total_comments);
- reset($total_entries);
- $count_total_items = count($total_entries);
- if (($count_search_items > 0) and ($count_total_items > 0)) {
- echo "<p>Found <b>$search</b> in $count_search_items out of $count_total_items ";
- if ($count_total_items == 1) {
- echo "entry";
- }
- if ($count_total_items > 1) {
- echo "entries";
- }
- if ($count_total_comments > 0) {
- echo " and $count_total_comments ";
- if ($count_total_comments == 1) {
- echo "comment";
- }
- if ($count_total_comments > 1) {
- echo "comments";
- }
- }
- echo " ($generation_time_item seconds).</p>";
- $increment_search_entries = 0;
- while ($increment_search_entries <= ($count_search_items - 1)) {
- $link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?entry=$show_search_items[$increment_search_entries]";
- $fix_link = array('//index.php', '///index.php');
- $link = str_replace($fix_link, '/index.php', $link);
- $link = trim($link);
- echo "<p><a href=$link";
- if (file_exists("data/items/$show_search_items[$increment_search_entries]/comments/live") and !preg_match("/\b$search\b/i",file_get_contents("data/items/$show_search_items[$increment_search_entries]/title.txt")) and !preg_match("/\b$search\b/i",file_get_contents("data/items/$show_search_items[$increment_search_entries]/body.txt"))) {
- echo "&show=comments";
- }
- echo ">";
- readfile("data/items/$show_search_items[$increment_search_entries]/title.txt");
- echo "</a><br>";
- readfile("data/items/$show_search_items[$increment_search_entries]/date.txt");
- echo "<br>";
- $body = file_get_contents("data/items/$show_search_items[$increment_search_entries]/body.txt");
- $body = strip_tags($body);
- $body = trim($body);
- // comment out next line for _long_ quote
- $body = str_replace(".","<br />", $body);
- if (file_exists("data/pf.txt") and file_exists("data/pf-badwords.txt")) {
- $badwords = file_get_contents("data/pf-badwords.txt");
- if (file_exists("data/pf-censor.txt")) {
- $censor = file_get_contents("data/pf-censor.txt");
- }
- else {
- $censor = "[expletive]";
- }
- $body = preg_replace("/\b($badwords)\b/i",$censor,$body);
- }
- $body = nl2br($body);
- $body = explode("<br />", $body);
- foreach ($body as $line) {
- if (preg_match("/\b$search\b/i", $line)) {
- $line = str_replace($search, "<span style=\"background-color: #ffff00;\">$search</span>", $line);
- $ucfirst_line = ucfirst($search);
- $line = str_replace($ucfirst_line, "<span style=\"background-color: #ffff00;\">$ucfirst_line</span>", $line);
- $strtoupper_line = strtoupper($search);
- $line = str_replace($strtoupper_line, "<span style=\"background-color: #ffff00;\">$strtoupper_line</span>", $line);
- $ucwords_line = ucwords($search);
- $line = str_replace($ucwords_line, "<span style=\"background-color: #ffff00;\">$ucwords_line</span>", $line);
- echo "$line ...<br>";
- }
- }
- echo str_replace("http://","",$link);
- $size = filesize("data/items/$show_search_items[$increment_search_entries]/body.txt");
- echo " - $size_string";
- echo "</p>";
- $increment_search_entries = $increment_search_entries + 1;
- }
- echo "<p>Click <a href=http://google.com/search?q=$google target=_maj>here</a> to search for <b>$search</b> with Google.<br>Click <a href=index.php>here</a> to go to the index page.</p>";
- }
- else {
- echo "<p>Search string not found in $count_total_items ";
- if ($count_total_items == 1) {
- echo "entry";
- }
- if ($count_total_items > 1) {
- echo "entries";
- }
- if ($count_total_comments > 0) {
- echo " and $count_total_comments ";
- if ($count_total_comments == 1) {
- echo "comment";
- }
- if ($count_total_comments > 1) {
- echo "comments";
- }
- }
- echo " ($generation_time_item seconds).<br><br>Click <a href=http://google.com/search?q=$google target=_maj>here</a> to search for <b>$search</b> with Google.<br>Click <a href=index.php>here</a> to go to the index page.</p>";
- }
- ?>