require_once('../Connections/bob.php'); $archive="search"; $search = str_replace(array("+","{","}","",""),"",$search); $currentPage = $_SERVER["PHP_SELF"]; // set page from nav jump if (isset($_POST['totalPages_search'])){ if($gopage>$_POST['totalPages_search']+1){ $gopage=$totalPages_search+1; } } if (isset($gopage)) { $pageNum_search=($gopage -1); } // set page from new search if (isset($newsearch)) { $pageNum_search=0; } // get moderator info mysql_select_db($database_bob, $bob); $query_moderators = "SELECT authlib_login.username, authlib_login.id, authlib_login.user_level, authlib_data.name, authlib_data.email FROM authlib_login, authlib_data WHERE authlib_login.id = authlib_data.id AND authlib_login.user_level>0"; $moderators = mysql_query($query_moderators, $bob) or die(mysql_error()); $row_moderators = mysql_fetch_assoc($moderators); $totalRows_moderators = mysql_num_rows($moderators); // turn all moderators array into array for each named by username do { ${$row_moderators['username']} = array('id'=>$row_moderators['id'],'user_level'=>$row_moderators['user_level'],'username'=>$row_moderators['username'],'email'=>$row_moderators['email']); } while ($row_moderators = mysql_fetch_assoc($moderators)); //wstrio search parameters $search="*rrr*"; $field="file"; $order_field="file"; $order="ASC"; // convert search string to array minus operators //$terms = explode('"', str_replace(array("+","-","*","~","\"","(",")","<",">","\\"),"",$search)); $terms = explode("\"", str_replace(array("+","-","*","~","(",")","<",">","\\"),"",$search)); // remove empty and whitespace array elements function isblank($element){ rtrim($element); return($element!=''); } $terms=array_filter($terms, "isblank"); // make $orig_search html compatible //$orig_search = str_replace('\"','"',$search); $orig_search = $search; $orig_search = str_replace("\"",""",$orig_search); $orig_search = str_replace("\\","",$orig_search); //$search=$orig_search; // highlight search terms function function highlight($buffer) { global $terms; $colors = array('004A54','540700','544300','54003B','035400','475400','2A0054','003300'); $i=0; // surround search item items with highlight class foreach($terms as $needle){ if ($i>count($colors)-1) { $i=0; } if (($needle=="&")||(strlen($needle)<2)){} else{ $buffer = eregi_replace($needle, "\\0", $buffer); } $i++; } return $buffer; } // sql syntax error function sql_err_zero($sql_query) { if (!(mysql_errno()==0)) { echo "