99999) {$sh=1;}
$page=($sh-1)/10; $page=$page+1;
if ($page<1) {$page=1;}
$contstring="Search Engine results for ".$kwd;
print "
";
if ($dispbooks!="N")
{
print "";
}
else
{
print " | ";
}
print " ";
include("scripts/leftbar2024.php");
include("scripts/sidebar2024.php");
print " ";
print "";
include("scripts/leftbar2024.php");
include("scripts/sidebar2024.php");
print " ";
print "";
include("scripts/leftbar2024.php");
include("scripts/sidebar2024.php");
print " ";
if ($dispbooks=="N")
{
print "";
include("scripts/leftbar2024.php");
print " ";
print "";
include("scripts/leftbar2024.php");
print " ";
}
print " | ";
if ($dispbooks!="N")
{
print "";
print "";
print " ";
print " ";
$kwd=html_entity_decode($kwd);
print " SEARCH ENGINE RESULTS ";
print "Your search for $kwd produced the following results. ";
print " ";
// work out and display search results
$notitles="0";
$totcnt=0;
// first off calculate the total number available for the selected keyword
// keyword must appear in title, blurb or the extract
// check title and blurb first - if not found then check the extract
if ($kwd!="" and $kwd!=" " and strlen($kwd)>2)
{
$kwde=mysqli_real_escape_string($linkse, $kwd);
$wordok="Y";
$filterstrg="pr_status='A' and pr_f4ok='Y' and (pr_style='R' or pr_style='E' or pr_style='S' or pr_style='D')";
$filterstrg=$filterstrg." and ((pr_autname LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_title LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_descrip LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd0 LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd1 LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd2 LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd3 LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd4 LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd5 LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd6 LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd7 LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd8 LIKE '%$kwde%')";
$filterstrg=$filterstrg." or (pr_kwd9 LIKE '%$kwde%'))";
$totcnt=0;
// first check the word is not in our banned list (00badwords)
$delims=" ";
$tstwrd= strtok( $kwd,$delims);
while ( is_string($tstwrd) )
{
if ($tstwrd)
{
$srword=" ".$tstwrd;
$result=mysqli_query($linkse, "SELECT * FROM 00badwords WHERE (bw_word='$srword')");
$bwcnt = mysqli_num_rows($result);
if ($bwcnt!=0) {$wordok="N"; }
$tstwrd= strtok($delims);
}
}
if ($wordok=="Y")
{
$result=mysqli_query($linkse, "SELECT * FROM 00productmeta WHERE $filterstrg ORDER by pr_f4gold DESC, pr_dtadd DESC");
// check the file to get total number to include based on exclusion rules
$wrdcnt = mysqli_num_rows($result);
$totcnt=$wrdcnt;
}
else {$totcnt=0;}
}
$numrows=$totcnt;
$endsh=(intval($numrows/20)*20)+1;
if (!isset($sh) or $sh==""){$sh=1;}
$prevsh=$sh-20;
$nextsh=$sh+20;
$shlast=$sh+19;
if ($shlast>$numrows){$shlast=$numrows;}
$pfcnt=0;
if ($numrows!=0)
{
if ($numrows>20)
{
print "";
print " ";
print " | ";
// based on the current page number
$curpage=(intval($sh/20))+1;
$starpage=(intval($curpage/10)*10)+1;
$finpage=(intval($numrows/20))+1;
$endpage=(intval($finpage/10)*10)+1;
$preendpage=$endpage-10;
if ($preendpage<1) {$preendpage=1; }
if ($curpage>20)
{
print "";
print " ";
print "";
print " | ";
}
else
{
print "";
print " | ";
}
if ($curpage>10)
{
$backcnt=$curpage-11;
$backcnt=$backcnt*20;
print "";
print " ";
print "";
print " | ";
}
else
{
print "";
print " | ";
}
print "";
print " ";
print "PAGE: ";
// now display 10 pages from the starpage count
$cnt=0;
$page=$starpage+$cnt;
while ($cnt<10 and $page<$finpage)
{
$page=$starpage+$cnt;
$startcnt=$page*20;
$startcnt=$startcnt-19;
if ($startcnt!=$sh)
{
$kwds=htmlspecialchars($kwd, ENT_QUOTES, 'UTF-8');
print " $page ";
}
else
{
print " $page ";
}
$cnt++;
}
print " | ";
if ($curpage<$endpage)
{
$nextcnt=$curpage+9;
$nextcnt=$nextcnt*20+1;
$fincnt=$finpage*20-19;
if ($nextcnt>$fincnt) {$nextcnt=$endpage*20-19;}
print "";
print " ";
print "";
print " | ";
}
else
{
print "";
print " | ";
}
if ($curpage<$preendpage)
{
$fincnt=$finpage*20-19;
print "";
print " ";
print "";
print " | ";
}
else
{
print "";
print " | ";
}
print " | ";
print " ";
} // if numrows>20
// now process the products file to get the relevant products for the search
if ($wordok=="Y")
{
$gotrec="N";
$srchkwd=trim($kwd);
// add the search word to our 00srchwords file
$resulte=mysqli_query($linkse, "SELECT * FROM 00srchwords where bw_word='$srchkwd'");
while($rowe = mysqli_fetch_row($resulte))
{
$gotrec="Y";
}
if ($issengine=="Y")
{
$gotrec="Y";
}
// if ($gotrec=="N")
// {
// mysqli_query($linkse, "INSERT INTO 00srchwords (bw_src, bw_word, bw_ipno, bw_approved) VALUES('F', '$kwd', '$usrip', 'Y')");
// }
$resultp=mysqli_query($linkse, "SELECT pr_code FROM 00productmeta WHERE $filterstrg ORDER by pr_f4gold DESC, pr_dtadd DESC");
}
while($rowp = mysqli_fetch_row($resultp))
{
$pr=$rowp[0];
$notitles="1";
$pfcnt++;
if ($pfcnt>=$sh and $pfcnt<=$shlast)
{
// now build up the display for the title...
include("scripts/bookprocmeta.php");
if ($imprint!="CO" or ($imprint=="CO" and $stkqty>0))
{
include("scripts/booklayout2022.php");
print " ";
}
} // end of product count
} // end of product read loop
}
if ($numrows>20)
{
print "";
print " ";
print " | ";
// based on the current page number
$curpage=(intval($sh/20))+1;
$starpage=(intval($curpage/10)*10)+1;
$finpage=(intval($numrows/20))+1;
$endpage=(intval($finpage/10)*10)+1;
$preendpage=$endpage-10;
if ($preendpage<1) {$preendpage=1; }
if ($curpage>20)
{
print "";
print " ";
print "";
print " | ";
}
else
{
print "";
print " | ";
}
if ($curpage>10)
{
$backcnt=$curpage-11;
$backcnt=$backcnt*20;
print "";
print " ";
print "";
print " | ";
}
else
{
print "";
print " | ";
}
print "";
print " ";
print "PAGE: ";
// now display 10 pages from the starpage count
$cnt=0;
$page=$starpage+$cnt;
while ($cnt<10 and $page<$finpage)
{
$page=$starpage+$cnt;
$startcnt=$page*20;
$startcnt=$startcnt-19;
if ($startcnt!=$sh)
{
print " $page ";
}
else
{
print " $page ";
}
$cnt++;
}
print " | ";
if ($curpage<$endpage)
{
$nextcnt=$curpage+9;
$nextcnt=$nextcnt*20+1;
$fincnt=$finpage*20-19;
if ($nextcnt>$fincnt) {$nextcnt=$endpage*20-19;}
print "";
print " ";
print "";
print " | ";
}
else
{
print "";
print " | ";
}
if ($curpage<$preendpage)
{
$fincnt=$finpage*20-19;
print "";
print " ";
print "";
print " | ";
}
else
{
print "";
print " | ";
}
print " | ";
print " ";
} // if numrows>20
if ($notitles=="0")
{
print "NO RESULTS FOUND FOR $kwd ";
print " ";
if ($bwflag=="Y")
{
print "This is a blocked search due to restrictions imposed on us. ";
}
}
print " | ";
print " ";
print " ";
print " | ";
}
print "
";
include("scripts/bottombar2024.php");
mysqli_close($linkse);
?>