home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / encyclopedia / search.php < prev   
Encoding:
PHP Script  |  2002-09-16  |  2.9 KB  |  71 lines

  1. <?php
  2.  
  3. ######################################################################
  4. # PHP-NUKE: Web Portal System
  5. # ===========================
  6. #
  7. # Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com)
  8. # http://phpnuke.org
  9. #
  10. # This program is free software. You can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 2 of the License.
  13. ######################################################################
  14.  
  15. if (!eregi("modules.php", $PHP_SELF)) {
  16.     die ("You can't access this file directly...");
  17. }
  18.  
  19. require_once("mainfile.php");
  20. $module_name = basename(dirname(__FILE__));
  21. get_lang($module_name);
  22. include("header.php");
  23.  
  24. if (isset($query) AND (isset($eid)) AND ($query != "")) {
  25.     $result = sql_query("select tid, title from ".$prefix."_encyclopedia_text where eid='$eid' AND title LIKE '%$query%'", $dbi);
  26.     $result2 = sql_query("select title from ".$prefix."_encyclopedia where eid='$eid'", $dbi);
  27.     list($ency_title) = sql_fetch_row($result2, $dbi);
  28.     title("$ency_title: "._SEARCHRESULTS."");
  29.     OpenTable();
  30.     echo "<center><b>"._SEARCHRESULTSFOR." <i>$query</i></b></center><br><br><br>"
  31.     ."<i><b>"._RESULTSINTERMTITLE."</b></i><br><br>";
  32.     if (sql_num_rows($result, $dbi) == 0) {
  33.         echo _NORESULTSTITLE;
  34.     } else {
  35.     while(list($tid, $title) = sql_fetch_row($result, $dbi)) {
  36.         echo "<strong><big>·</big></strong>  <a href=\"modules.php?name=$module_name&op=content&tid=$tid\">$title</a><br>";
  37.     }
  38.     }
  39.     $result = sql_query("select tid, title from ".$prefix."_encyclopedia_text where eid='$eid' AND text LIKE '%$query%'", $dbi);
  40.     echo "<br><br><i><b>"._RESULTSINTERMTEXT."</b></i><br><br>";
  41.     if (sql_num_rows($result, $dbi) == 0) {
  42.         echo _NORESULTSTEXT;
  43.     } else {
  44.     while(list($tid, $title) = sql_fetch_row($result, $dbi)) {
  45.         echo "<strong><big>·</big></strong>  <a href=\"modules.php?name=$module_name&op=content&tid=$tid&query=$query\">$title</a><br>";
  46.     }
  47.     }
  48.     echo "<br><br>"
  49.     ."<center><form action=\"modules.php?name=$module_name&file=search\" method=\"post\">"
  50.     ."<input type=\"text\" size=\"20\" name=\"query\">  "
  51.     ."<input type=\"hidden\" name=\"eid\" value=\"$eid\">"
  52.     ."<input type=\"submit\" value=\""._SEARCH."\">"
  53.     ."</form><br><br>"
  54.     ."[ <a href=\"modules.php?name=$module_name&op=list_content&eid=$eid\">"._RETURNTO." $ency_title</a> ]<br><br>"
  55.     .""._GOBACK."</center>";
  56.     CloseTable();
  57. } else {
  58.     OpenTable();
  59.     echo "<center>"._SEARCHNOTCOMPLETE."<br><br><br>"
  60.     ."<center><form action=\"modules.php?name=$module_name&file=search\" method=\"post\">"
  61.     ."<input type=\"text\" size=\"20\" name=\"query\">  "
  62.     ."<input type=\"hidden\" name=\"eid\" value=\"$eid\">"
  63.     ."<input type=\"submit\" value=\""._SEARCH."\">"
  64.     ."</form><br><br>"
  65.     .""._GOBACK."</center>";
  66.     CloseTable();
  67. }
  68.  
  69. include("footer.php");
  70.  
  71. ?>