%@ page language="java" import="yahoo.*" session="false" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.net.InetAddress" %>
<%@ include file="header.jsp" %>
<%@ include file="sidebar.jsp" %>
<% String control1 = request.getParameter("limit1");
String control2 = request.getParameter("limit2");
if (control1 == null || control2 == null) { %>
<% } %>
<% /* --------------------------------------------------------- */
/* -- First dealing with queries in which the person asked to see related sites...
in other words, the parameter "showsite" is not null ---- */
String simm = request.getParameter("showsite");
if (simm != null) {
/* ---- Counting the number of similar sites in the database ---- */
ResultSet count = show.getGenericShow();
int results = 0;
while (count.next() ) { results++; }
InetAddress local1 = java.net.InetAddress.getLocalHost();
String la1= local1.getHostAddress();
/* ---- Display the keyword that the user submitted in the query --- */
String keyword = request.getParameter("searchword");
/* --- Creating a header with the match count and keyword--- */
out.print("
"+(results)+" similar ");
/* -- some quick grammar corrections --- */
if (results == 1) { out.print("site ");} else { out.print("sites "); }
out.print("for keyword: "+(keyword)+"
");
/* ----ResultSets are handled in two different methods...first, creating special
URLs for sites on my local server with 127.0.0.1----- */
if (simm.equals("51") || simm.equals("52") || simm.equals("50")) { ResultSet simsite = show.getGenericShow();
while (simsite.next()) {
String url2=simsite.getString(3).trim();
String title2=simsite.getString(4).trim();
out.print(""+(title2)+"
");
} } else
{ ResultSet simsite = show.getGenericShow();
while (simsite.next()) {
String url2=simsite.getString(3).trim();
String title2=simsite.getString(4).trim();
out.print(""+(title2)+"
");
} }
} else { // ending showsite vs. normal search if-statement
/* ------------------------------------------------------------------ */
/* -- Now dealing with regular keyword searches ---- */
/* ---- Counting the TOTAL number of sites found in the database ---- */
ResultSet count = search.getGenericSearch();
int numrows = 0;
while (count.next() ) { numrows++; }
/* ---- Count the TOTAL number being shown ----- */
ResultSet count2 = search.getGenericSearchLimited();
int numrows2 = 0;
while (count2.next() ) { numrows2++; }
/* ---- Display the keyword that the user submitted in the query --- */
String searchword = request.getParameter("searchword");
/* --- Creating a header with the match count and keyword--- */
InetAddress local2 = java.net.InetAddress.getLocalHost();
String la2= local2.getHostAddress();
out.print("
Your search for "+(searchword)+" found "+(numrows)+"");
/* -- some quick grammar corrections --- */
if (numrows == 1) { out.print(" match. ");} else if (numrows == 0)
{ out.print(" : NO Matches."); } else { out.print(" matches. "); }
/* --- Explaining how many matches are being shown on this page --- */
out.print("
Showing "+(numrows2)+" .");
out.print("