JHSearch ($ SEARCH

zhaozj2021-02-16  86

TYPE: CODE FRAGMENT VERSION: VERSION 1.0 Requires: no_search_words.txt, no_search_tables.txt

";

}}}} ($ SR [$ I] == "Class") {// this is checking to see reason the table name is Media for ($ C = 0; $ SEARCHRESULT [$ SR [$ I ]); $ C ) {Echo "Class:". $ SearchResult [$ SR [$ I]] [$ C] ['Title']. "
";}}} / * #### ######################################################################################################################################################################################################################################################################################################## ######## ################################################################################################################################################################################################################################################################################################## ############## ********************************* ****************************************** Function: JHSearch ($ search_string) Purpose: Search An entire Database and return the results in a 3 dimensional array Words found in no_search_words.txt will not be searched Table names found in no_search_tables.txt will not be searched result example:... $ result [table_name] [row] [field_name] Author: James R Hartford * *********************************************************** ********* / Function JHSearch ($ String) {$ newstring = $ string; $ searchcrit = expedition ("", $ newstr ing); // get the words to be searched $ dontsearchwords = JHgetnos ( "words"); // get the words not to search into an array // get the actual search criteria $ searchcrit = array_diff ($ searchcrit, $ dontsearchwords) $ Searchcrit = jharray_reindex ($ searchcrip); // get the tables to search $ query = "show tables"; $ TABLES = JHRQUERY ($ query); for ($ i = 0; $ i

Array_diff ($ TABLES, $ TABLETAKEOUT); $ TABLES = Jharray_reIndex ($ TABLES); $ RESULTCOUNT = 0; // Build The Search Query for ($ I = 0; $ TABLES) && Count ($ SEARCHCRIT) > 0; $ i ) {$ query = "Select * from"; $ query. = $ TABLES [$ I]. "Where"; $ q = "show fields from". $ TABLES [$ I]; $ fields = JhrQuery ($ = 0; $ m 0) {$ query. = "(";} for ($ SC = 0 $ SC 0 && $ m
"; $ tempResult [$ tables [$ i]] = JHRquery ($ query);

} IF ($ TABLES [$ I]] [0]! = "") {$ RealResult [$ TABLES [$ I]] = TempResult [$ TABLES [$ I]];}} Return $ RealResult; } / ******************************************************* ******** Function: Jhgetnos ($ where); purpose: paare a text file to find out what not to search author: james r Hartford ************** *********************************************************************************************************************** {// Get the Words That Should Not Be Searched for if ($ Where == "Words") {$ filename = "no_search_words.txt";} // Get the Tables That Should Not Be Searched Else IF ($ Where == "Tables") {$ filename = "no_search_tables.txt";} $ handle = fopen ($ FileName, "R"); $ Contents = Explode ("", FREAD ($ Handle, FileSize)); fclose ($ handle); return $ contents;} / *************************************************** ***************** Function: jharray_reindex ($ array); purpose: Reindex an Array Author: James r Hartford ************** ***************************** **************** / Function Jharray_reIndex ($ SomeArray) {$ Keys = Array_Keys ($ SomeArray); for ($ I = 0; $ I

转载请注明原文地址:https://www.9cbs.com/read-13075.html

New Post(0)