"; print_r($_GET); print ""; exit; */ $formObj = new Form($_GET); // initialize $dbObj = new MySQLConnector(array('host'=>HOST,'user'=>DBUSER,'password'=>DBPASS,'database'=>DBNAME)); $siteDataObj = new SiteData($dbObj); $stateDataArr = getStateArr($dbObj); $breedsdDataArr = getBreedsArr($dbObj); $dirLink = ""; /* RECORDING HITS LEGEND All classifieds breederID, breedID, classifiedID are NULL and pageType = classified By Breed breederID, stateID, classifiedID are NULL, breedID is numeric and pageType = classified By State breederID, breedID, classifiedID are NULL, stateID is numeric and pageType = classified Specific classified breedID and stateID is NULL, breederID and classifiedID are numeric and pageType = classified */ if(!isset($_GET['page']))$_GET['page'] = 1; if(isset($_GET['showall'])){ // show all classifieds $query = "SELECT classifieds.title, classifieds.dateAdded, classifieds.type, state.stateName, breeders.name, breeders.linkName,breeders.city, classifieds.id, COUNT(classifiedImages.id) AS imgCount FROM (classifieds LEFT JOIN classifiedImages ON classifieds.id = classifiedImages.ownerID AND classifiedImages.imageData != ''),breeders,state,breeds WHERE classifieds.expires >= NOW() AND classifieds.ownerID = breeders.id AND breeders.active = 1 AND state.id = breeders.state AND classifieds.category = breeds.id GROUP BY classifieds.id ORDER BY IF(breeders.expires >=NOW(),0,1), classifieds.dateAdded DESC, classifieds.id DESC"; $pg=&new Pager($dbObj,$query,40); $resArr = $pg->displayRecords($_GET['page'],"puppy-for-sale"); if(count($resArr['results'])>0){ $html = "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; $a = 0; foreach($resArr['results'] as $row){ if($a == 20) $html .= getAdsense(); $html .= formatListing($row, $a, $siteDataObj); $a++; } if($a>5) $html .= "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; } else { $html .= "

Sorry, we do not have any listings at this time

"; } $pageTitle = "Hunting Dogs and Puppies For Sale"; $metaDescription = "View gun dog breeder classified ads for puppy litters, finished and started dogs for sale in all gun dog breeds and locations"; $metaKeywords = "puppy for sale, started dog, finished, litter, bird dog, puppies, gun dogs, sporting breeds, dog breeders, classified, ads, hunting"; // record hit //$dbObj->performQuery("INSERT INTO traffic SET mark = NOW(), referringIP = '{$_SERVER['REMOTE_ADDR']}', type = 'incoming', pageType='classified'"); } else if(isset($_GET['breed']) && $_GET['breed']!= "you-must-select-a-breed"){ // show classifieds by breed $html = ""; $query = "SELECT id,breeds,description FROM breeds WHERE breeds LIKE '".$dbObj->cleanInput(LinkFormat::stripDashes($_GET['breed']))."'"; $dbObj->performQuery($query); if($row = $dbObj->fetchRow()){ $cbreed = $row['breeds']; $breedID = $row['id']; } else { print ""; exit; $html = showImproperRequest(); $pageTitle = "Error"; } $stateQuery = ""; $stateSearchLink = ""; if (isset($_GET['state']) && is_numeric($_GET['state'])&& $_GET['state']>0){ $stateQuery = "AND breeders.state = ".@$dbObj->cleanInput($_GET['state']); $stateSearchLink = "&state={$_GET['state']}"; } $featuredHTML = getFeaturedClassifieds($dbObj,$siteDataObj,'breed',$breedID,$cbreed); $query = "SELECT classifieds.title, classifieds.dateAdded,classifieds.type, state.stateName, breeders.name, breeders.linkName, breeders.city, breeders.expires, classifieds.id, COUNT(classifiedImages.id) AS imgCount FROM (classifieds LEFT JOIN classifiedImages ON classifieds.id = classifiedImages.ownerID AND classifiedImages.imageData != ''),breeders,state,breeds WHERE classifieds.expires >= NOW() AND classifieds.ownerID = breeders.id AND breeders.active = 1 AND state.id = breeders.state AND breeds.breeds LIKE '".Linkformat::stripDashes($_GET['breed'])."' AND classifieds.category = breeds.id $stateQuery GROUP BY classifieds.id ORDER BY IF(breeders.expires >=NOW(),0,1), classifieds.dateAdded DESC"; $pg=&new Pager($dbObj,$query,40); $resArr = $pg->displayRecords($_GET['page'],"","breed={$_GET['breed']}&submit=SEARCH".$stateSearchLink); if(count($resArr['results'])>0){ $html = "$featuredHTML
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; $a = 0; foreach($resArr['results'] as $row){ if($a == 20) $html .= getAdsense(); $html .= formatListing($row, $a, $siteDataObj); $a++; } if($a>5) $html .= "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; } else { $html .= "

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


"; $html .= "

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

"; $html .= "

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

"; } $pageTitle = "$cbreed Hunting Dogs and $cbreed Puppies For Sale"; $metaDescription = "View all $cbreed hunting dog puppies for sale including new litters, stud dogs, started and finished dogs for sale"; $metaKeywords = "$cbreed, $cbreed puppies, hunting dogs, puppies for sale, sporting dog breed, classified ad, dog for sale, puppies, puppy litter, started, finished, bird, hunting, gun dog breeders"; // 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['breed'])."'), type = 'incoming', pageType='classified'"); } else if(isset($_GET['state'])){ // show classifieds by state // check that state exists in database if(is_numeric($_GET['state'])){ $dbObj->performQuery("SELECT * FROM state WHERE id = {$_GET['state']}"); } else { $dbObj->performQuery("SELECT * FROM state WHERE stateName LIKE '".Linkformat::stripDashes($_GET['state'])."'"); } if($dbObj->getNumRows()==0){ $html = showImproperRequest(); $pageTitle = "Error"; } else { $stateData = $dbObj->fetchRow(); $_GET['state'] = $stateData['stateName']; } $featuredHTML = getFeaturedClassifieds($dbObj,$siteDataObj,'state',$stateData['id'],$stateData['stateName']); $query = "SELECT classifieds.title,classifieds.type, classifieds.dateAdded, state.stateName, breeders.name, breeders.linkName, breeders.city, classifieds.id, breeds.breeds, COUNT(classifiedImages.id) AS imgCount FROM (classifieds LEFT JOIN classifiedImages ON classifieds.id = classifiedImages.ownerID AND classifiedImages.imageData != ''),breeders,state,breeds WHERE classifieds.expires >= NOW() AND classifieds.ownerID = breeders.id AND breeders.active = 1 AND state.id = breeders.state AND state.stateName LIKE '".Linkformat::stripDashes($_GET['state'])."' AND classifieds.category = breeds.id GROUP BY classifieds.id ORDER BY IF(breeders.expires >=NOW(),0,1), classifieds.dateAdded DESC"; $pg=&new Pager($dbObj,$query,40); $resArr = $pg->displayRecords($_GET['page'],$_GET['state']); if(count($resArr['results'])>0){ $html = "$featuredHTML
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; $a = 0; foreach($resArr['results'] as $row){ if($a == 20) $html .= getAdsense(); $html .= formatListing($row, $a, $siteDataObj); $a++; } if($a>5) $html .= "
".$pg->getPageResults($_GET['page'])."
Page {$_GET['page']}   ".$resArr['links']."
"; } else { $html .= "

Sorry, we do not currently have any classified ad listings for puppies for sale in ".Linkformat::stripDashes($_GET['state'])."

"; $html .= "

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

"; } $dirLink = "

mobileSiteURL/breeders-".Linkformat::addDashes($_GET['state'],lcase)."/\">Search for breeders in ".Linkformat::stripDashes($_GET['state'])."

"; $pageTitle = "Hunting Dogs and Puppies for sale in ".Linkformat::stripDashes($_GET['state']); $metaDescription = "View gun dog classified ads offering hunting dog puppies for sale in ".Linkformat::stripDashes($_GET['state'])." for all hunting dog breeds "; $metaKeywords = ""; // record hit //$dbObj->performQuery("INSERT INTO traffic SET mark = NOW(), referringIP = '{$_SERVER['REMOTE_ADDR']}', stateID = (SELECT id FROM state WHERE stateName LIKE '".Linkformat::stripDashes($_GET['state'])."'), type = 'incoming', pageType='classified'"); } else if(isset($_GET['id']) && is_numeric($_GET['id'])){ // show specific classified $query = "SELECT classifieds.*, breeders.name, breeders.linkName, breeders.id as breederID, state.stateName, breeds.breeds as breedName, breeds.id as breedID, breeders.city, breeders.expires as bExpired FROM classifieds,breeders,state,breeds WHERE breeders.state = state.id AND classifieds.ownerID = breeders.id AND breeders.active = 1 AND breeds.id = classifieds.category AND classifieds.id = ".$_GET['id']; $dbObj->performQuery($query); if($row = $dbObj->fetchRow()){ if(strtotime($row['bExpired'])>strtotime("now")){ $paid=1; $dataContainerClass = "dataContainer2"; } else { $dataContainerClass = "dataContainer"; } $html= ""; $breederID = $row['breederID']; $breedsID = $row['breedID']; $description = $row['description']; $cBreed = $row['breedName']; $formObj->postVars['breed'] = LinkFormat::adddashes($row['breedName'],lcase); $pageTitle = "{$row['title']} - {$row['breedName']}s in ".((trim($row['city'])!="")?"{$row['city']}, ":"")."{$row['stateName']} - {$row['name']} "; $query = "SELECT count(id) as recCount FROM classifiedImages WHERE ownerId = ".$_GET['id']." AND imageData != ''"; $dbObj->performQuery($query); if($crow = $dbObj->fetchRow()){ if($crow['recCount']>0) { //$html .="
My Classified Pictures
"; $query = "SELECT id, imgDescription FROM classifiedImages WHERE ownerID = ".$_GET['id']." order by showOrder"; $dbObj->performQuery($query); //if($paid){ $imageData = array(); $a = 0; while($imageRow = $dbObj->fetchRow()){ $imageData[$a] = "
"; $imageData[$a] .= "\"{$imageRow['imgDescription']}\""; $imageData[$a] .= "

{$imageRow['imgDescription']}

"; $imageData[$a] .= "
"; $a++; } $html .= implode(" ",$imageData); /*} else { while($imageRow = $dbObj->fetchRow()){ $html .= " 
"; $html .= " \"{$imageRow['imgDescription']}\""; $html .= "

{$imageRow['imgDescription']}

"; $html .= "

"; } } */ } } $html .="
 
"; if($row['sold']==1){ $html .= "
THIS AD MARKED AS SOLD
"; } else { //$html .= '
'; //$html .= "
mobileSiteURL}/emailfriend.html?cid={$row['id']}\" rel=\"nofollow\" class=\"email link\">Email a friend
"; } if(trim($row['email'])!="") $html .= "
mobileSiteURL}/contactClassified".$row['id'].".html\" class=\"email link\">Email {$row['name']} about this ad.
\n"; $html .= "
$description
\n"; $html .= "
Ad location: ".((trim($row['city'])!="")?"{$row['city']}, ":"")."{$row['stateName']}
\n"; $html .= "
Ad created: ".formatDate($row['dateAdded'])."
\n"; $html .= "
"; $html .= "

\n"; $infoHTML = ""; if(trim($row['contactName'])!="") $infoHTML .= "Contact: ".$row['contactName']."
\n"; if(trim($row['phone'])!="") $infoHTML .= "
".$row['phone']."
\n"; if(trim($row['phone2'])!="") $infoHTML .= "
".$row['phone2']."
\n"; if(trim($row['cell'])!="") $infoHTML .= "
".$row['cell']."
\n"; if(trim($infoHTML)!=""){ $html .= "
$infoHTML
"; } if(trim($row['email'])!="") $html .= " mobileSiteURL}/contactClassified".$row['id'].".html\" class=\"email link\">Contact breeder through email\n"; if(trim($row['website'])!="") $html .= "Click here to visit website\n"; $html .= "
\n"; $html .= "

mobileSiteURL."/breeders-".LinkFormat::addDashes($row['stateName'],lcase)."/".LinkFormat::addDashes($row['linkName'],lcase).".html\" class=\"link\">".$row['name']." Breeder Information

\n"; $html .= "
\n"; if(trim($row['pedigrees'])!=""){ $html .= "
Pedigrees

"; $dbObj->performQuery("SELECT title, id FROM pedigrees WHERE id IN({$row['pedigrees']})"); while($pRow = $dbObj->fetchRow()){ $html .= "{$pRow['title']}
"; } $html .= "

"; } $metaDescription = showFirst($description,255); $metaKeywords = "$cBreed for sale, $cBreed puppies, started {$cBreed}s, finished, studs, puppy, litter, dog breeder"; // get classifieds for sidemenu by breed $sideMenuHTML = getSMClassifieds($dbObj,$siteDataObj,'breed',$breedsID,$cBreed); // record hit $dbObj->performQuery("INSERT INTO traffic SET mark = NOW(), referringIP = '{$_SERVER['REMOTE_ADDR']}', classifiedID = {$_GET['id']}, breederID= $breederID, type = 'incoming', pageType='classified'"); } else { $html = showImproperRequest(); } } else if(isset($_GET['show'])){ switch($_GET['show']){ case "litterAnnouncements": $pageTitle = "Hunting Dogs For Sale - Litter Announcements"; $metaDescription = "View all hunting dog puppies for sale and gun dog Litter Announcements with bird dogs for sale"; $metaKeywords = "Puppies for sale, Litter Announcements, bird dog pups, puppy classified ads, dog for sale, puppies, puppy litter, started, lab, brittany, gsp, german shorthaired pointer, bird, hunting, gun dog breeders"; $fileName = "litter_announcements"; $showType = "litter announcement"; $sqlType = "Litter Announcement"; break; case "startedDogs": $pageTitle = "Started Hunting Dogs For Sale - Started Bird Dogs"; $metaDescription = "View all started dog gun dog classifieds"; $metaKeywords = "Started dog classifieds, started bird dog, classified ad, started dog for sale, started gun dog, finished, bird dog, hunting, gun dog breeders"; $fileName = "started_dogs"; $showType = "started dog"; $sqlType = 'Started Dog'; break; case "finishedDogs": $pageTitle = "Finished Dogs For Sale - Finished Hunting Dogs"; $metaDescription = "View all finished gun dog classifieds"; $metaKeywords = "Finished dog classifieds, sporting dog breed, classified ad, finished dog for sale, finished bird dog, started, finished, bird, hunting, gun dog breeders"; $fileName = "finished_dogs"; $showType = "finished dog"; $sqlType = 'Finished Dog'; break; case "studFee": $pageTitle = "Stud Fees - Hunting Dog Studs"; $metaDescription = "View all gun dog stud fee classifieds"; $metaKeywords = "Stud fee classifieds, stud fees, classified ad, stud dog for sale, hunting dog stud, german shorthair stud, brittany, lab stud, bird dog stud, hunting, gun dog breeders"; $fileName = "stud_fee"; $showType = "stud fee"; break; case "dogTraining": $pageTitle = "Dog Training / Gear For Sale Classifieds"; $metaDescription = "View all gun dog training and gear for sale classified ads"; $metaKeywords = "Dog training classifieds, gun dog trainers, professional, obedience, gear for sale, force fetch, wing and shot, started, finished, bird dog training, hunting, gun dog breeders"; $fileName = "dog_training"; $showType = "dog training"; break; default: break; } $html = '

'; } else { if($_SERVER['REQUEST_URI'] =="/mobile/viewClassifieds.html"){ header('Location: '.$siteDataObj -> mobileSiteURL.'/index.html', true, 301); } else { $html = showImproperRequest(); } } ?> <?= $pageTitle ?>- <?= $siteDataObj -> siteName?>

"; if(strtotime("now") < strtotime($row['expires'])){ $html .= "\"Double"; } $html .= ((isset($row['imgCount'])&&$row['imgCount']>0)?"siteURL."/images/cameraIcon.gif\" alt=\"\" /> ":"")."mobileSiteURL."/classifieds/".$row['id'].".html\">".$row['title']."
"; if($row['type'] != null){ $html .= "Ad type: {$row['type']} | "; } $html .= "Location: ".$row['city']." - ".$row['stateName']."
"; $html .= "Breeder: mobileSiteURL."/breeders-".Linkformat::addDashes($row['stateName'],lcase)."/".Linkformat::addDashes($row['linkName'],lcase).".html\">".$row['name']." | "; $html .= "Created: ".formatDate($row['dateAdded'])."
"; $html .= ""; return $html; } function getStateList(&$dbObj, &$stateDataArr,$mobileSiteURL){ $breedersArr = array(); $itemArr = array(); $html .="
"; return $html; } function getBreedList(&$dbObj,&$breedsDataArr,$mobileSiteURL,&$formObj){ $breedersArr = array(); $itemArr = array(); $query = "SELECT count(classifieds.id) as classifiedCount, classifieds.category FROM classifieds,breeders WHERE classifieds.expires >= NOW() AND classifieds.ownerID = breeders.id AND breeders.active = 1 GROUP BY classifieds.category"; $dbObj->performQuery($query); while($row = $dbObj->fetchRow()){ $breedersArr[$row['category']] = $row['classifiedCount']; } foreach($breedsDataArr as $key => $value){ if(trim($value)!=""){ $itemArr[LinkFormat::addDashes($value,lcase)] = $value." ".((array_key_exists($key,$breedersArr))?"(".$breedersArr[$key].") ":""); } } return $formObj->selectTag("name=breed",$itemArr); } function getSMClassifieds(&$dbObj,&$siteDataObj,$type,$typeParam,$properName){ $returnHTML = ""; $subSQL = ""; switch($type){ case 'breed': $subSQL = "AND classifieds.category = $typeParam"; break; case 'state': $subSQL = "AND breeders,state = $typeParam"; break; default: $subSQL = ""; break; } /// get 20 most recently added classifieds $query = "SELECT breeders.name, breeders.linkName, breeders.expires, breeders.city, state.stateName, classifieds.title, classifieds.id, breeds.breeds, COUNT(classifiedImages.id) AS imgCount FROM (classifieds LEFT JOIN classifiedImages ON classifieds.id = classifiedImages.ownerID AND classifiedImages.imageData != ''),breeders,state,breeds WHERE breeders.state = state.id AND breeds.id = classifieds.category $subSQL AND classifieds.ownerID = breeders.id AND breeders.active = 1 AND classifieds.expires >= NOW() GROUP BY classifieds.id ORDER BY classifieds.id DESC LIMIT 30"; $dbObj->performQuery($query); while($row = $dbObj->fetchRow()){ $linkHTML = ""; if($row['imgCount'] > 0){ $linkHTML = "\"\" "; $linkTitle = showfirst($row['title'],35); } else { $linkTitle = showfirst($row['title'],40); } $linkHTML .= breakString($linkTitle,22); $returnHTML .= '
'; /* if(strtotime("now") < strtotime($row['expires'])){ $returnHTML .= "\"Double"; } */ $returnHTML .= ' '.$linkHTML.' '.$row['name'].' in '.((trim($row['city'])!="")?$row['city'].", ":"").' '.$row['stateName'].'
'; } $returnHTML = "
More $properName Puppies and Dogs for sale.
".$returnHTML; return $returnHTML; } function getFeaturedClassifieds(&$dbObj,&$siteDataObj,$type,$typeParam,$properName){ $returnHTML = ""; $subSQL = ""; switch($type){ case 'breed': $subSQL = "AND classifieds.category = '$typeParam'"; break; case 'state': $subSQL = "AND breeders.state = '$typeParam'"; break; default: $subSQL = ""; break; } /// don't grab featured ads that have sold set to 1 $query = "SELECT breeders.name, breeders.linkName, breeders.expires, breeders.city, state.stateName, classifieds.title, classifieds.description, classifieds.id, breeds.breeds, COUNT(classifiedImages.id) AS imgCount, classifiedImages.id as imageID, classifiedImages.imgDescription FROM (classifieds LEFT JOIN classifiedImages ON classifieds.id = classifiedImages.ownerID AND classifiedImages.imageData != ''),breeders,state,breeds WHERE breeders.state = state.id AND breeds.id = classifieds.category $subSQL AND classifieds.ownerID = breeders.id AND breeders.active = 1 AND classifieds.featured >= NOW() AND sold = 0 GROUP BY classifieds.id ORDER BY RAND(),classifiedImages.showOrder ASC LIMIT 30"; $dbObj->performQuery($query); $resArr = array(); while($row = $dbObj->fetchRow()){ $resArr[] = $row; } if(count($resArr)>0){ foreach($resArr as $row){ $linkHTML = ""; if($row['imgCount'] > 0){ //$linkHTML = "\"\" "; $linkHTML .= "\"{$row['imgDescription']}\""; $linkTitle = showfirst($row['title'],120); } else { $linkTitle = showfirst($row['title'],120); } $linkHTML .= breakString($linkTitle,22); $returnHTML .= '
'; $returnHTML .= ' '.$linkHTML.'
'.showFirst($row['description'],130).'
'.$row['name'].' located in '.((trim($row['city'])!="")?$row['city'].", ":"").' '.$row['stateName'].'
 
'; } $returnHTML = "
Featured $properName Puppies for sale.
$returnHTML
"; } return $returnHTML; } ?>