HOST,'user'=>DBUSER,'password'=>DBPASS,'database'=>DBNAME)); $siteDataObj = new SiteData($dbObj); $stateDataArr = getStateArr($dbObj); $breedsdDataArr = getBreedsArr($dbObj); $sideMenuHTML = ""; if(!isset($_GET['page']))$_GET['page'] = 1; // determine page request type if(trim($_SERVER['QUERY_STRING'])==""){ // show state list of breeders with count $breedersArr = array(); $html .= "

Protection Dog breeders by state

"; $query = "SELECT COUNT(breeders.id) as breederCount, state.stateName, countries.country FROM state LEFT JOIN breeders ON (state.id = breeders.state AND breeders.active = 1), countries WHERE state.country = countries.id GROUP BY state.id ORDER BY state.stateName"; $dbObj->performQuery($query); while($row = $dbObj->fetchRow()){ $breedersArr[$row['country']][] = $row; } foreach($breedersArr as $key => $value){ $itemArr = array(); if(is_array($value) && count($value)>0){ foreach($value as $stateBreederData){ $itemArr[] = "{$stateBreederData['stateName']}". (($stateBreederData['breederCount']>0)?" (".$stateBreederData['breederCount'].")":""); } } $html.= tableResults($itemArr,3,100,$key,"",'class="tableList"'); } $html .= "

Protection Dog breeders by breed

"; // clear breeders array for next data set $breedersArr = array(); $itemArr = array(); $query = "SELECT breeds FROM breeders WHERE active = 1"; $dbObj->performQuery($query); while($row = $dbObj->fetchRow()){ if(trim($row['breeds'])!=""){ $tBreedArr = explode(",",$row['breeds']); foreach($tBreedArr as $value){ $breedersArr[$value]++; } } } foreach($breedsdDataArr as $key => $value){ if(trim($value)!="" && $key != 0){ $itemArr[] = "$value". ((array_key_exists($key,$breedersArr))?" (".$breedersArr[$key].")":"")."
"; } } $html.= tableResults($itemArr,2,100,""); $pageTitle = "Protection Dog Breeders"; $metaDescription = "Protection dog breeders by State or by K9 dog breeds. Puppies for sale K9 classified ads include trained personal protection dogs for sale."; $metaKeywords = "Protection dogs, K9 dogs, guard dog breeders, Protection dog trainers, security dog, puppies for sale, trained male, female, puppies, working dog breeds"; // record hit //$dbObj->performQuery("INSERT INTO traffic SET mark = NOW(), referringIP = '{$_SERVER['REMOTE_ADDR']}', type = 'incoming', pageType='breeder'"); } else if(isset($_GET['breederName']) && isset($_GET['stateID'])){ // show breeder data $query = "SELECT breeders.id, breeders.name, breeders.linkName, breeders.services, breeders.address, breeders.zip, breeders.city, breeders.phone, breeders.secPhone, breeders.contact, breeders.writeup, breeders.businessYrs, breeders.breeds, breeders.dateModified, breeders.logo, breeders.imgExt, breeders.expires, breeders.email, breeders.website, state.stateName, count(classifieds.id) as classifiedsCount FROM breeders LEFT JOIN classifieds ON classifieds.ownerID = breeders.id AND classifieds.expires >= NOW(), state WHERE breeders.state = state.id AND breeders.linkName LIKE '".linkFormat::stripDashes($_GET['breederName'])."' AND breeders.active = 1 AND state.stateName LIKE '".LinkFormat::stripDashes($_GET['stateID'])."' GROUP BY breeders.id"; $dbObj->performQuery($query); if($row = $dbObj->fetchRow()){ $html = ""; $services = ""; if(strtotime($row['expires'])>strtotime("now")){ $paid=1; $dataContainerClass = "dataContainer2"; } else { $dataContainerClass = "dataContainer"; } if(trim($row['logo']!="" && trim($row['imgExt']!=""))){ if($row['imgExt']==".png"){ } else { $html.= "siteURL."/logoImages/".$row['id'].$row['imgExt']."\" alt=\"".$row['name']."\" class=\"breederLogo\"/>
"; } } $breederID = $row['id']; if(trim($row['writeup'])!=""){ $html .= "
About ".$row['name']."
"; $html .= "
".preg_replace("~ ~"," ",$row['writeup'])."
"; } $thisBreedsArr = getBreedNames($row['breeds'],&$breedsdDataArr); $html .= "
Hunting Dog Breeds Raised
"; $html .= "
".implode(", ",$thisBreedsArr)."
"; $sideMenuHTML .= '
Search by Breed
'; foreach($thisBreedsArr as $value){ $sideMenuHTML.="
$value
"; } $sideMenuHTML.="Search Breeders by ".LinkFormat::stripDashes($_GET['stateID']).""; $sideMenuHTML.=" "; if(trim($row['services'])!=""){ $services = str_replace(",",", ",$row['services']); $html .= "
Additional Services
"; $html .= "
$services
"; } $html .= "
Breeder Contact Info
"; $html .= "
".$row['contact']."
"; if(trim($row['address'])!="")$html .= $row['address']."
"; if(trim($row['city'])!="")$html .= $row['city'].", "; $html .= $row['stateName']; if(trim($row['zip'])!="")$html .= " ".$row['zip']; $html .="
"; if($row['businessYrs']>0){ $html .= "
Breeding quality K9 dogs for over {$row['businessYrs']} years.
"; } if(trim($row['phone'])!="") $html .= "
".$row['phone']."
"; if(trim($row['secPhone'])!="") $html .= "
".$row['secPhone']."
"; if(trim($row['email'])!="") $html .= "siteURL}/contactBreeder{$breederID}.html\" class=\"email\">Send Email to {$row['name']}"; if(trim($row['website'])!="") $html .= "Click here to visit {$row['name']} website
"; $html .= "
"; if($row['classifiedsCount']>0){ $html .= "
Puppies for sale
\n
"; $query = "SELECT title,id FROM classifieds WHERE classifieds.ownerID = $breederID AND expires >= NOW() ORDER BY dateAdded DESC"; $dbObj->performQuery($query); while($cRow = $dbObj->fetchRow()){ $html.="siteURL."/classifieds/".$cRow['id'].".html\" class=\"breederSMLink\">".$cRow['title'] .""; } $html .= "
"; } // get pedigrees $query = "SELECT title, id FROM pedigrees WHERE owner = ".$row['id']." AND showOnBreedPage = 1 ORDER BY title"; $dbObj->performQuery($query); $pedigreeArr = array(); while($pRow = $dbObj->fetchRow()){ $pedigreeArr[] = "{$pRow['title']}"; } if(count($pedigreeArr)>0){ $html .= "
Our K9 Pedigrees
"; $html .= "
"; $html .= implode("
",$pedigreeArr); $html .= "

"; } // get testimonials $testInitLimit = 10; $query = "SELECT count(id) as totalReviews FROM reviews WHERE ownerID = {$row['id']} AND active = 1 "; $dbObj->performQuery($query); if($revCount = $dbObj->fetchRow()){ $totalReviews = $revCount['totalReviews']; } else { $totalReviews = 0; } $query = "SELECT name, dateCreated, rating, comment FROM reviews WHERE ownerID = ".$row['id']." AND (active = 1 OR ip = '".$_SERVER['REMOTE_ADDR']."') ORDER BY dateCreated DESC LIMIT $testInitLimit"; $dbObj->performQuery($query); $reviewArr =array(); while($rRow = $dbObj->fetchRow()){ $reviewArr[] = "
Submitted by: ".$rRow['name']." on ".formatDate($rRow['dateCreated'])."
".nl2br($rRow['comment']); } $html .= "
Testimonials ($totalReviews)"; $html .= ($totalReviews>$testInitLimit)?' You are viewing the 10 most recent - Click here for more reviews':""; $html .= "
"; $html .= "
"; if(count($reviewArr)>0){ $html .= implode("
",$reviewArr); } else { $html .= "No testimonials for this breeder"; } $html .= "

"; $html.= ($totalReviews>$testInitLimit)?'More Reviews for '.$row['name'].'   |  ':""; $html .= "siteURL."/testimonials.html?breederID=".$row['id']."\">>> Submit your testimonial"; $html .="

"; $html .= "

"; $pageTitle = "{$row['name']} - {$row['stateName']} ".implode(", ",$thisBreedsArr)." Breeders"; $metaDescription = showFirst($row['writeup'],255); $metaKeywords = showFirst($row['name'],255).", ".$row['stateName']." Protection dog breeder, ".implode(", ",$thisBreedsArr).", puppies for sale, K9 litters, trained Protection dogs, studs, breed, puppies, dogs".((trim($services)!="")?" ,$services":""); // record hit $dbObj->performQuery("INSERT INTO traffic SET mark = NOW(), referringIP = '{$_SERVER['REMOTE_ADDR']}', breederID= {$row['id']}, type = 'incoming', pageType='breeder'"); } else { //$html = showImproperRequest(); //$pageTitle = "Error"; $query = "SELECT stateName FROM state WHERE stateName LIKE '".LinkFormat::stripDashes($_GET['stateID'])."'"; $dbObj->performQuery($query); if($row = $dbObj->fetchRow()){ header ("HTTP/1.0 404 Not Found"); $pageTitle = LinkFormat::stripDashes($_GET['breederName'])." is not listed on our site"; $html = "To view other breeders in {$row['stateName']} click here"; /// show breed list $breedLinksArr = getBreedCountList($dbObj); $html .= "
View K9 breeders by protection dog breed
"; $html .= tableResults($breedLinksArr,1,100,""); } else { showImproperRequest(); exit(); } } } else if(isset($_GET['breeds'])){ // show breeders by breeds. $html = ""; $query = "SELECT breeds,description, id FROM breeds WHERE breeds LIKE '".LinkFormat::stripDashes($_GET['breeds'],SQLREADY)."'"; $dbObj->performQuery($query); if($row = $dbObj->fetchRow()){ $breed = $row['breeds']; $breedID = $row['id']; } else { showImproperRequest(); exit(); } $query = "SELECT breeders.name, breeders.linkName, breeders.services, breeders.city, breeders.breeds, breeders.dateModified, breeders.id, state.stateName, breeds.id as breedIdent, breeders.expires, COUNT(reviews.id) as reviewCount FROM breeders LEFT JOIN reviews ON reviews.ownerID = breeders.id AND reviews.active = 1, state, breeds WHERE breeders.state = state.id AND breeders.active = 1 AND breeds.id = $breedID AND breeders.breeds REGEXP CONCAT('(,|^)',breeds.id,'(,|$)') GROUP BY breeders.id ORDER BY IF(breeders.expires >=NOW(),0,1), reviewCount DESC, breeders.businessYrs DESC"; $pg=&new Pager($dbObj,$query,50); $resArr = $pg->displayRecords($_GET['page'],"breeders"); if(count($resArr['results'])>0){ $html = "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; $thisPageAd = getCategoryAd($dbObj,$breedID,'ads_by_cat'); if($thisPageAd!=""){ $html .= $thisPageAd; } else { $html .= getAdsense(); } $a = 0; $breederDataArr = array(); foreach($resArr['results'] as $row){ $breederDataArr[] = $row; } foreach($breederDataArr as $row){ //if($a == 25) $html .= getAdsense(); $thisBreedsArr = getBreedNames($row['breeds'],$breedsdDataArr); $html .= formatListing($row, $a, $siteDataObj, $thisBreedsArr, $dbObj); $stateName = $row['stateName']; $a++; } if($a>5) $html .= "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; } else { $html .= "

About the ".$breed."
".$row['description']."


"; $html .= "

Sorry, we do not have any listings for this protection dog breed

"; $html .= "

siteURL.$_SERVER['PHP_SELF']."\">Click here to do another search.

"; } $pageTitle = "$breed Puppies For Sale by $breed Breeders, Trainers and Kennels"; $metaDescription = "Find $breed puppies for sale from Protection dog breeders who raise $breed puppies and offer trained $breed dogs, training and $breed puppies for sale."; $metaKeywords = "$breed puppies for sale, $breed breeders, $breed for sale, $breed dogs, trained Protection Male, Protection dog Puppies, K9 Breeders, Kennels, studs, pups"; // record hit //$dbObj->performQuery("INSERT INTO traffic SET mark = NOW(), referringIP = '{$_SERVER['REMOTE_ADDR']}', breedID = (SELECT id FROM breeds WHERE breeds LIKE '".Linkformat::stripDashes($_GET['breeds'])."'), type = 'incoming', pageType='breeder'"); } else if(isset($_GET['stateID'])){ // Breeders by State // assumes only state has been set $stateID = LinkFormat::stripDashes($_GET['stateID']); $query = "SELECT breeders.name,breeders.linkName,breeders.services,breeders.city, breeders.breeds, breeders.dateModified, breeders.id, state.stateName,state.abbv, breeders.expires, COUNT(reviews.id) as reviewCount FROM breeders LEFT JOIN reviews ON reviews.ownerID = breeders.id, state WHERE breeders.state = state.id AND breeders.active = 1 AND state.stateName LIKE '$stateID' GROUP BY breeders.id ORDER BY IF(breeders.expires >=NOW(),0,1), reviewCount DESC, breeders.businessYrs DESC"; $pg=&new Pager($dbObj,$query,50); $resArr = $pg->displayRecords($_GET['page'],"breeders"); $stateClassifiedLink = "View puppies for sale in $stateID by $stateID Protection dog breeders."; if(count($resArr['results'])>0){ $html = "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; $html .= getAdsense(); $a = 0; $breederDataArr = array(); foreach($resArr['results'] as $row){ $breederDataArr[] = $row; } foreach($breederDataArr as $row){ //if($a == 25) $html .= getAdsense(); $thisBreedsArr = getBreedNames($row['breeds'],$breedsdDataArr); $stateName = "{$row['stateName']}"; $html .= formatListing($row, $a, $siteDataObj, $thisBreedsArr, $dbObj); $a++; } if($a>5) $html .= "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; } else { $query = "SELECT stateName, abbv FROM state WHERE stateName LIKE '$stateID'"; $dbObj->performQuery($query); if($row = $dbObj->fetchRow()){ $stateName = "{$row['abbv']} – {$row['stateName']}"; $html .= "

Sorry, we don't have any listings for Protection Dog Breeders in this state.

"; $html .= "

siteURL.$_SERVER['PHP_SELF']."\">Click here to do another search.

"; } else { showImproperRequest(); exit(); } } $pageTitle = "Protection Dog Puppies in $stateName and $stateName K9 Dog Breeders"; $metaDescription = "Protection dog breeders in $stateName with Protection dog puppies for sale as well as trained K9 Protection dogs raised and trained in $stateName."; $metaKeywords = "$stateName Protection dog breeders, K9 guard dogs, puppies for sale, $stateName dog kennels, Protection breeders, kennel, Protection Dog Training"; // record hit //$dbObj->performQuery("INSERT INTO traffic SET mark = NOW(), referringIP = '{$_SERVER['REMOTE_ADDR']}', stateID = (SELECT id FROM state WHERE stateName LIKE '$stateID'), type = 'incoming', pageType='breeder'"); } else if(isset($_GET['allBreeders'])){ // All breeders by alpha $resultsPerPage = 50; $query = "SELECT breeders.name,breeders.linkName,breeders.city,breeders.breeds,breeders.dateModified, breeders.expires, breeders.id, state.stateName, count(classifieds.id) as classifiedsCount FROM state, breeders LEFT JOIN classifieds ON (breeders.id = classifieds.ownerID AND classifieds.expires >= NOW()) WHERE breeders.active = 1 AND breeders.state = state.id GROUP BY breeders.id ORDER BY IF(breeders.expires >=NOW(),0,1), breeders.name"; $pg=&new Pager($dbObj,$query,$resultsPerPage); $resArr = $pg->displayRecords($_GET['page'],"allBreeders"); $a = 0; if(count($resArr['results'])>0){ $html = "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; $html .= getAdsense(); $breederDataArr = array(); foreach($resArr['results'] as $row){ $breederDataArr[] = $row; } foreach($breederDataArr as $row){ //if($a == 25) $html .= getAdsense(); $thisBreedsArr = getBreedNames($row['breeds'],$breedsdDataArr); $html .= formatListing($row, $a, $siteDataObj, $thisBreedsArr, $dbObj); $stateName = $row['stateName']; $a++; } if($a>5) $html .= "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; } $pageTitle = "All Protection Dog Breeders in USA and Canada"; $metaDescription = "Protection dog breeders in USA and Canada with Protection dog puppies for sale as well as trained Protection dogs and working dog breeds."; $metaKeywords = "Protection dogs, Protection dog breeder, K9 guard dogs, USA dog breeders, Canada puppies for sale, kennel, Protection dog training, trained dogs for sale"; $metaSEO = ""; } else if(isset($_GET['canadaBreeders'])){ // Canada breeders by alpha $resultsPerPage = 50; $html = ""; $query = "SELECT COUNT(breeders.id) as breederCount, state.stateName, countries.country FROM state LEFT JOIN breeders ON (state.id = breeders.state AND breeders.active = 1), countries WHERE state.country = countries.id AND breeders.country = 2 GROUP BY state.id ORDER BY state.stateName"; $dbObj->performQuery($query); while($row = $dbObj->fetchRow()){ $breedersArr[$row['country']][] = $row; } foreach($breedersArr as $key => $value){ $itemArr = array(); if(is_array($value) && count($value)>0){ foreach($value as $stateBreederData){ $itemArr[] = "{$stateBreederData['stateName']}". (($stateBreederData['breederCount']>0)?" (".$stateBreederData['breederCount'].")":""); } } $html.= tableResults($itemArr,2,100,"Protection Dog Breeders by Canadian Provinces","",'class="tableList"'); } $query = "SELECT breeders.name,breeders.linkName,breeders.city,breeders.breeds,breeders.dateModified, breeders.expires, breeders.id, state.stateName, count(classifieds.id) as classifiedsCount FROM state, breeders LEFT JOIN classifieds ON (breeders.id = classifieds.ownerID AND classifieds.expires >= NOW()) WHERE breeders.active = 1 AND breeders.state = state.id AND breeders.country = 2 GROUP BY breeders.id ORDER BY IF(breeders.expires >=NOW(),0,1), breeders.name"; $pg=&new Pager($dbObj,$query,$resultsPerPage); $resArr = $pg->displayRecords($_GET['page'],"allBreeders"); $a = 0; if(count($resArr['results'])>0){ $html .= "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; $html .= getAdsense(); $breederDataArr = array(); foreach($resArr['results'] as $row){ $breederDataArr[] = $row; } foreach($breederDataArr as $row){ //if($a == 25) $html .= getAdsense(); $thisBreedsArr = getBreedNames($row['breeds'],$breedsdDataArr); $html .= formatListing($row, $a, $siteDataObj, $thisBreedsArr, $dbObj); $stateName = $row['stateName']; $a++; } if($a>5) $html .= "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; } $pageTitle = "Protection Dog Breeders in Canada"; $metaDescription = "Protection dog breeders in Canada with best Protection dog puppies for sale as well as trained K9 Protection dogs for sale."; $metaKeywords = "Protection dogs for sale, puppies for sale, Protection dog breeders, K9 dogs for sale, Protection dog kennel, trained Protection dogs for sale, best Protection breeds"; $metaSEO = ""; } else { showImproperRequest(); exit(); } ?> <?= $pageTitle ?> - <?= $siteDataObj -> siteName?> metaDescription) ?>"/> metaKeywords) ?>"/>

$stateClassifiedLink"; ?>
Want to list your puppies for sale? Post a classified today!
"; if(strtotime("now") < strtotime($row['expires'])){ $html .= "\"Paid"; } //$html.= strtotime($row['expires'])."-".strtotime("now"); $html .= "siteURL."/breeders-".LinkFormat::addDashes($row['stateName'],lcase)."/".LinkFormat::addDashes($row['linkName'],lcase).".html\" class=\"breederLink\">".$row['name'].""; $html .= " ".$row['city']." - ".$row['stateName']."
"; $dbObj->performQuery("SELECT COUNT(*) as cCount FROM classifieds WHERE ownerID = {$row['id']} AND expires >= NOW()"); if($row = $dbObj->fetchRow()){ if($row['cCount'] >0){ $html .= "We currently have an active classified
"; } } if(count($thisBreedsArr)>0) $html .= "Protection Dog Breeds Raised: ".implode(", ",$thisBreedsArr).""; $html .= ""; return $html; } function getBreedNames($breeds,&$breedsdDataArr){ $thisBreedsArr = array(); $dbBreeds = explode(",",$breeds); if(count($dbBreeds)>0){ foreach($dbBreeds as $value){ if($value!=0){ $thisBreedsArr[] = $breedsdDataArr[$value]; } } } return $thisBreedsArr; } function getCategoryAd(&$dbObj,$breedID,$table){ $html = ''; $query = "SELECT * FROM $table WHERE category = $breedID AND end > DATE_SUB(NOW(),INTERVAL 1 DAY) AND start <= NOW() "; $dbObj->performQuery($query); if($row = $dbObj->fetchRow()){ $html = "

\"\"/

"; } return $html; } ?>