PHP Classes

File: Search.php

Recommend this page to a friend!
  Classes of Eric Chipko   CISVC   Search.php   Download  
File: Search.php
Role: Example script
Content type: text/plain
Description: Example
Class: CISVC
Encapsulates Microsoft Indexing Service
Author: By
Last change:
Date: 20 years ago
Size: 2,634 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PHP Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php
   
require_once("cisvcclass.inc.php");
   
$strSearchString = "";
    if (
$_SERVER['REQUEST_METHOD']="POST") {
       
$strSearchString = $_REQUEST['SearchString'];
       
$iPG = $_REQUEST['pg'];
    }

?>
<style type="text/css">
<!--
.pagetitle {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: x-large;
    font-weight: bold;
}
.doctitle {
    font-weight: bold;
}
.wdAbstract {
    font-style: italic;
    font-weight: bold;
    text-align: justify;
}
.url {
    font-size: smaller;
    font-style: italic;
}
.filesize {
    font-size: smaller;
    font-style: italic;
}
.filetime {
    font-size: smaller;
    font-style: italic;
}
.characterization {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: smaller;
   
}

-->
</style>
</head>
<body>
<p class="pagetitle">Sample PHP Search Form</p>
<table width="75%" border="0">
  <tr>
    <td>Enter your query below</td>
  </tr>
  <tr>
    <td><form name="form1" id="form1" method="post" action="<?php echo($_SERVER['SCRIPT_NAME']); ?>">
        <table width="100%" border="0">
          <tr>
            <td width="83%"><input name="SearchString" type="text" id="SearchString" size="80" maxlength="100" value="<?=$strSearchString?>" /></td>
            <td width="17%"><input type="submit" name="Submit" value="New Query" /></td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>

</body>
<?php
   
if ($strSearchString <> "") {
        if (
$iPG <= 0 ) { // Get the first page of data
           
$oSearch = new CISVC($strSearchString);
        } else {
// $iPG is specifying a page number (0 indexed)
           
$oSearch = new CISVC($strSearchString, $iPG);
        }
// end if $iPG
       
if ($oSearch->iRecordCount > 0 ) {
            echo (
"<br/>Documents ".$oSearch->iFirstDocinPage." to ".$oSearch->iLastDocinPage." of ".$oSearch->iRecordCount);
            echo (
" matching the query".chr(34)."<i>".$strSearchString."</i>".chr(34)."<p></p>\n");
           
$oSearch->HTMLShowPage();
           
$oSearch->HTMLShowMessages();
           
$oSearch->HTMLNavBar();
           
$oSearch->HTMLPageSummary();
        } else {
// oSearch->iRecordCount < 0
           
echo ("<p>No documents matched the query ".chr(34).$strSearchString.chr(34)."</p>");
        }
// end if iRecordCount > 0
   
} else { // Search String is NULL
       
echo "<p>Please enter a word or phrase to search for.</p>";
    }
// end if Search String not NULL
?>
</html>