session_start();
$root="/usr/home/deb3977n3/domains/morechemistry.com/public_html";
include("${root}/includes/layout_page.php");
layout_load();
#META INFORMATION
//$filetosave="";
$category="links";
$title="Links - Search";
$keywords="search, links, chemistry";
$description="search chemistry related links";
include("${root}/members/includes/members-common.php");
include("${root}/members/includes/members-config.php");
include("${root}/members/includes/members-links.php");
# copyright 2000-2009, morechemistry.com, All Rights Reserved
##################################### SUBROUTINES ######################################
menu_load($category);
$content=$menu;
$content.="
UNDER CONSTRUCTION
";
$content.="Your links
";
# page value
$pv=$_REQUEST['pv'];
if ($pv == "") { $pv=1; }
if ($pv<1) { $pv=1; }
##################################### SUBROUTINES ######################################
function create_list($searchword,$pv)
{
global $startPage;
global $EntryID;
$wText=$_SESSION['wText'];
$selection="WHERE LOCATE('$searchword',LinkDescription)>0 ";
$allrecords=get_specific_userowned_records("links",$selection,"");
$FoundOne=mysql_num_rows($allrecords);
if ($FoundOne==0) { $foundStr="No links found!"; }
if ($FoundOne==1) { $foundStr="1 link found!"; }
if ($FoundOne>0)
{
if ($wText=="1")
{
# allow to turn off
$switchtextsetting="hide full description";
}
else
{
#allow to turn on
$switchtextsetting="show full description";
}
}
$startPage=1;
$buttonbar="";
if ($FoundOne>1)
{
$foundStr="${FoundOne} links found!";
if ($FoundOne>10)
{
$buttonbar=make_buttonbar("/links/links-search.php?frmSearchStr=${searchword}&pv=",$FoundOne,$pv);
}
}
# report number of links found in new LOCAL content
$content="${foundStr} ${switchtextsetting}
\n";
$content.=$buttonbar."
\n";
# show the results
if ($FoundOne>0)
{
# collect the records ordered and limited to 10
$entrycount=$startPage-1;
$allrecords=get_specific_userowned_records("links",$selection,"ORDER BY LinkSubtopic LIMIT $entrycount,10");
# read the names of the categories
$catsub=read_sub_categories();
# set some initial values before starting the loop
$maincat=0; # current MAIN category
$maincatcalc=0; # calculated MAIN category
$subcat=0; # current SUB category
$subcatcalc=0; # calculated SUB category
$entrycount=$startPage-1;
while ($data=mysql_fetch_array($allrecords))
{
$Category=$data[LinkSubtopic];
$Title=$data[LinkTitle];
$Url=$data[LinkURL];
$Text=$data[LinkDescription];
$EntryID=$data[LinkLongID];
$Mark=$data[LinkChecked];
if ($Category != $subcat ) # display header for subcategory
{
$subcat=$Category;
$content.="";
$content.=" $catsub[$Category]\n";
$content.="
\n";
}
$content.=make_sample($Url,$Title,$Text,$Mark,$wText,0,"#ccffff");
}
}
$content.=$buttonbar."
\n";
return $content;
}
function create_form($frmSearchStr)
{
$form=<<
FORM;
return $form;
}
##################################### MAIN PROGRAM ######################################
$frmSearchStr=$_REQUEST['frmSearchStr'];
$content=create_form($frmSearchStr);
$content.=create_list($frmSearchStr,$pv);
layout_show($layoutpage,$content,$googlecode,$title,$keywords,$description);
?>