1) { $i=$page-1; $last=make_link($baseurl.'&page='.$i, make_image('caret-l.gif', 'previous').'previous'); } if ($page<$pages) { $i=$page+1; $next=make_link($baseurl.'&page='.$i, 'next page'.make_image('caret-r.gif', 'next') ); } $middle="Displaying results $firstdisplayed to $lastdisplayed"; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
' . $middle . '
'; spacer(1,1); echo '
' . $last . '
' . $next . '

' . "\n"; } if(!isset($pattern)) { commonHeader("Site Search"); $form = $PHP_SELF; ?>

Search

Search for:

Restrict the search to:

Search Results\n"; if (have_search() && isset($htsearch_prog)) { $form = $PHP_SELF; } else { $form="http://www.php.net/search.php"; } if (!isset($base)) { if (ereg("^(.+//[^/]+)/",$HTTP_REFERER,$reg)) { $base=$reg[1]; } if ($base == $MYSITE) { $base = "-"; } } $sourceurl = htmlentities($base == '-' ? $PHP_SELF : $base.$PHP_SELF); if ($pattern == "") { echo "Error: No search words specified.

"; echo "Click here for a New Search

\n"; CommonFooter(); exit(); } $words = escapeshellcmd (urlencode($pattern)); $config = "php"; if ($show == "source") { $exclude = "/manual"; $restrict = $MYSITE."source"; $where = "Site source code"; } elseif ($show == "manual") { $restrict = $MYSITE."manual/en"; $exclude = "/source"; $where = "PHP documentation"; } else { $exclude = "/source"; $restrict = $MYSITE; $where = "PHP Web site"; } if (isset($page)) { $off = "&page=".escapeshellcmd($page); } else { $off = ""; } $query = "words=$words&config=$config&exclude=$exclude&restrict=$restrict$off"; exec("$htsearch_prog \"$query\"", $result); $rc = count($result); if ($rc<2) { echo "There was an error executing this query.

Please try later.

"; commonFooter(); exit; } if ($result[2] == "NOMATCH") { echo "Sorry, no documents matched your search for "".htmlspecialchars($pattern)."".

"; echo "Click here for a New Search

\n"; commonFooter(); exit; } $matches = $result[2]; $firstdisplayed = $result[3]; $lastdisplayed = $result[4]; $page = $result[5]; $pages = $result[6]; $baseurl = htmlentities($PHP_SELF."?pattern=$words&show=$show&base=$base"); echo "$matches documents match your search for '",htmlspecialchars($pattern),"' in the $where:

\n"; echo "Click here for a New Search

\n"; makeBar($page,$pages,$baseurl,$firstdisplayed,$lastdisplayed); $i=7; #skip response header while ($i < $rc) { if ($base == "-") { echo $result[$i]; } else { echo eregi_replace("http://[^.]+\.php\.net/",htmlspecialchars("$base/"),$result[$i]); } echo "\n"; $i++; echo hdelim("#cccccc"); } echo "
\n"; makeBar($page,$pages,$baseurl,$firstdisplayed,$lastdisplayed); echo "

Search powered by
\n"; print_link("http://www.htdig.org/", make_image("htdig.gif", "ht://Dig") ); echo "

\n"; } commonFooter(); ?>