'200'){ $buffer = home(); echo $buffer; exit; }
$ziplength = strlen($searchzip); if($ziplength>'50'){ $buffer = home(); echo $buffer; exit; }
$citylength = strlen($searchcity); if($citylength>'100'){ $buffer = home(); echo $buffer; exit; }
////// set video player var based on company //////
if (preg_match("/634-Polymag-Tek/i", $searchcompany)) {
$videocode = '
Meech Intl. Introduces Unique Features to Hyperion Static Controllers
';
}
else{
$cattop = '';
$template = file_get_contents('https://directory.pffc-online.com/templates/template2.html');
$template = preg_replace("//", "$title", $template);
$template = preg_replace("//", "$breadcrumbs", $template);
$template = preg_replace("//", "$cattop$content$catbottom", $template);
$template = preg_replace("//", "$featuredcompanies", $template);
echo $template;
}///// end function subcats
////
function compcats($taxonomy,$limit,$start,$page){
$taxonomy = preg_replace("/^(\d+)-(.*)/", "$1", $taxonomy);
if(!$limit){$limit = "20";}
if(!$start){$start = "0";}
//how many items to show per page
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else{
$start = 0;
}
/// for breadcrumbs
$querybread = mysql_query("SELECT * FROM `categories` WHERE `id` = '$taxonomy' LIMIT 1");
while($a=mysql_fetch_array($querybread)) { $breadparent=$a["ParentID"]; }
$querybreada = mysql_query("SELECT * FROM `categories` WHERE `id` = '$breadparent'");
while($b=mysql_fetch_array($querybreada))
{
$breadcatid=$b["id"];
$breadcatname=$b["CategoryName"];
$breadcatalias=$b["CategoryAlias"];
}
/// main queries
$query = mysql_query("SELECT * FROM `categories` WHERE `id` = '$taxonomy'");
if(mysql_num_rows($query) == 0) {
$emptymessage = 'No matches found
';
}
else{
while($r=mysql_fetch_array($query))
{
$catid=$r["id"];
$catname=$r["CategoryName"];
$catalias=$r["CategoryAlias"];
$catlevel=$r["Level"];
$catparent=$r["ParentID"];
/// for nav
$querynav = mysql_query("SELECT * FROM `compcats` WHERE `CategoryID` = '$catid'");
$navmatches = mysql_num_rows($querynav);
$queryb = mysql_query("SELECT * FROM `compcats` WHERE `CategoryID` = '$catid' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$compmatches = mysql_num_rows($queryb);
while($s=mysql_fetch_array($queryb))
{
$companyid=$s["CompanyID"];
$package=$s["Package"];
$queryc = mysql_query("SELECT * FROM `companies` WHERE `id` = '$companyid'");
if(mysql_num_rows($queryc) == 0) {
echo 'No matches found
';
}
else{
while($c=mysql_fetch_array($queryc))
{
$companyname=$c["CompanyName"];
$companyalias=$c["Alias"];
$city=$c["PublishedCity"];
$state=$c["PublishedState"];
$imagesmall=$c["ImageSmall"];
if (preg_match("/platinum/i", $package)) {
$content .= '';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
if($imagesmall){$content .= ' ';}
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/gold/i", $package)) {
$content .= '';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/basic/i", $package)) {
$content .= '';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
}
}
}
}
}
$title = $catname . ' | PFFC Online Buyers Guide';
$breadcrumbs = 'PFFC Online Buyers Guide » '.$breadcatname.' » '. $catname;
$cattop = 'Search results for "'.$catname.'"
Results: '.$navmatches.' Companies
';
$cattop .= '
';
$cattop .= ' ';
$cattop = preg_replace('/option value="'.$limit.'"/', 'option value="'.$limit.'" selected="selected"', $cattop);
$catbottom = '
';
$pagination = getPaginationString($page, $navmatches, $limit, '3', 'index.html', '?taxonomy='.$catid.'-'.$catalias.'&limit='.$limit.'&page=');
$template = file_get_contents('https://directory.pffc-online.com/templates/template2.html');
$template = preg_replace("//", "$title", $template);
$template = preg_replace("//", "$breadcrumbs", $template);
$template = preg_replace("//", "$cattop$content$catbottom$pagination", $template);
echo $template;
}///// end function compcats
////
function comppage($searchcompany,$videocode){
$searchcompany = preg_replace("/^(\d+)-(.*)/", "$1", $searchcompany);
$query = mysql_query("SELECT * FROM `companies` WHERE `id` = '$searchcompany'");
if(mysql_num_rows($query) == 0) {
$emptymessage = 'No matches found
';
}
else{
while($c=mysql_fetch_array($query))
{
$compid=$c["id"];
$compname=$c["CompanyName"];
$compaddress01=$c["PublishedAddress01"];
$compaddress02=$c["PublishedAddress02"];
$compcity=$c["PublishedCity"];
$compstate=$c["PublishedState"];
$compzip=$c["PublishedZip"];
$compphone=$c["PublishedPhone"];
$comptollfreephone=$c["PublishedTollFreePhone"];
$compfax=$c["PublishedFax"];
$compwebsite=$c["Website"];
$compcountry=$c["PublishedCountry"];
$compregionsserved=$c["RegionsServed"];
$compcertificationtype=$c["CertificationType"];
$contactfirstname=$c["FirstName"];
$contactlastname=$c["LastName"];
$companydescription=$c["CompanyDescription"];
$companydescription = preg_replace("/\n/", " ", $companydescription);
$companydescription = preg_replace("/(|<\/p>|
||<\/ul>|<\/li>)\r /", "$1\n", $companydescription);
$imagelarge=$c["ImageLarge"];
$comppackage=$c["Package"];
$compenhanced=$c["Enhanced"];
$distributors=$c["Distributors"];
$distributors = preg_replace("/\n/", " ", $distributors);
$manufacturerreps=$c["ManufacturerReps"];
$manufacturerreps = preg_replace("/\n/", " ", $manufacturerreps);
$territories=$c["Territories"];
$territories = preg_replace("/\n/", " ", $territories);
$productlines=$c["ProductLines"];
$productlines = preg_replace("/\n/", " ", $productlines);
$additionallocations=$c["AdditionalLocations"];
$compcountry = preg_replace("/^US$/", "United States", $compcountry);
$compcountry = preg_replace("/^AF$/", "Afghanistan", $compcountry);
$compcountry = preg_replace("/^AL$/", "Albania", $compcountry);
$compcountry = preg_replace("/^DZ$/", "Algeria", $compcountry);
$compcountry = preg_replace("/^AS$/", "American Samoa", $compcountry);
$compcountry = preg_replace("/^AD$/", "Andorra", $compcountry);
$compcountry = preg_replace("/^AO$/", "Angola", $compcountry);
$compcountry = preg_replace("/^AI$/", "Anguilla", $compcountry);
$compcountry = preg_replace("/^AQ$/", "Antarctica", $compcountry);
$compcountry = preg_replace("/^AG$/", "Antigua and Barbuda", $compcountry);
$compcountry = preg_replace("/^AR$/", "Argentina", $compcountry);
$compcountry = preg_replace("/^AM$/", "Armenia", $compcountry);
$compcountry = preg_replace("/^AW$/", "Aruba", $compcountry);
$compcountry = preg_replace("/^AU$/", "Australia", $compcountry);
$compcountry = preg_replace("/^AT$/", "Austria", $compcountry);
$compcountry = preg_replace("/^AZ$/", "Azerbaidjan", $compcountry);
$compcountry = preg_replace("/^BS$/", "Bahamas", $compcountry);
$compcountry = preg_replace("/^BH$/", "Bahrain", $compcountry);
$compcountry = preg_replace("/^BD$/", "Bangladesh", $compcountry);
$compcountry = preg_replace("/^BB$/", "Barbados", $compcountry);
$compcountry = preg_replace("/^BY$/", "Belarus", $compcountry);
$compcountry = preg_replace("/^BE$/", "Belgium", $compcountry);
$compcountry = preg_replace("/^BZ$/", "Belize", $compcountry);
$compcountry = preg_replace("/^BJ$/", "Benin", $compcountry);
$compcountry = preg_replace("/^BM$/", "Bermuda", $compcountry);
$compcountry = preg_replace("/^BT$/", "Bhutan", $compcountry);
$compcountry = preg_replace("/^BO$/", "Bolivia", $compcountry);
$compcountry = preg_replace("/^BA$/", "Bosnia-Herzegovina", $compcountry);
$compcountry = preg_replace("/^BW$/", "Botswana", $compcountry);
$compcountry = preg_replace("/^BV$/", "Bouvet Island", $compcountry);
$compcountry = preg_replace("/^BR$/", "Brazil", $compcountry);
$compcountry = preg_replace("/^IO$/", "British Indian Ocean Territory", $compcountry);
$compcountry = preg_replace("/^BN$/", "Brunei Darussalam", $compcountry);
$compcountry = preg_replace("/^BG$/", "Bulgaria", $compcountry);
$compcountry = preg_replace("/^BF$/", "Burkina Faso", $compcountry);
$compcountry = preg_replace("/^BI$/", "Burundi", $compcountry);
$compcountry = preg_replace("/^KH$/", "Cambodia", $compcountry);
$compcountry = preg_replace("/^CM$/", "Cameroon", $compcountry);
$compcountry = preg_replace("/^CA$/", "Canada", $compcountry);
$compcountry = preg_replace("/^CV$/", "Cape Verde", $compcountry);
$compcountry = preg_replace("/^KY$/", "Cayman Islands", $compcountry);
$compcountry = preg_replace("/^CF$/", "Central African Republic", $compcountry);
$compcountry = preg_replace("/^TD$/", "Chad", $compcountry);
$compcountry = preg_replace("/^CL$/", "Chile", $compcountry);
$compcountry = preg_replace("/^CN$/", "China", $compcountry);
$compcountry = preg_replace("/^CX$/", "Christmas Island", $compcountry);
$compcountry = preg_replace("/^CC$/", "Cocos (Keeling) Islands", $compcountry);
$compcountry = preg_replace("/^CO$/", "Colombia", $compcountry);
$compcountry = preg_replace("/^KM$/", "Comoros", $compcountry);
$compcountry = preg_replace("/^CG$/", "Congo", $compcountry);
$compcountry = preg_replace("/^CK$/", "Cook Islands", $compcountry);
$compcountry = preg_replace("/^CR$/", "Costa Rica", $compcountry);
$compcountry = preg_replace("/^HR$/", "Croatia", $compcountry);
$compcountry = preg_replace("/^CU$/", "Cuba", $compcountry);
$compcountry = preg_replace("/^CY$/", "Cyprus", $compcountry);
$compcountry = preg_replace("/^CZ$/", "Czech Republic", $compcountry);
$compcountry = preg_replace("/^DK$/", "Denmark", $compcountry);
$compcountry = preg_replace("/^DJ$/", "Djibouti", $compcountry);
$compcountry = preg_replace("/^DM$/", "Dominica", $compcountry);
$compcountry = preg_replace("/^DO$/", "Dominican Republic", $compcountry);
$compcountry = preg_replace("/^TP$/", "East Timor", $compcountry);
$compcountry = preg_replace("/^EC$/", "Ecuador", $compcountry);
$compcountry = preg_replace("/^EG$/", "Egypt", $compcountry);
$compcountry = preg_replace("/^SV$/", "El Salvador", $compcountry);
$compcountry = preg_replace("/^GQ$/", "Equatorial Guinea", $compcountry);
$compcountry = preg_replace("/^ER$/", "Eritrea", $compcountry);
$compcountry = preg_replace("/^EE$/", "Estonia", $compcountry);
$compcountry = preg_replace("/^ET$/", "Ethiopia", $compcountry);
$compcountry = preg_replace("/^FK$/", "Falkland Islands", $compcountry);
$compcountry = preg_replace("/^FO$/", "Faroe Islands", $compcountry);
$compcountry = preg_replace("/^FJ$/", "Fiji", $compcountry);
$compcountry = preg_replace("/^FI$/", "Finland", $compcountry);
$compcountry = preg_replace("/^CS$/", "Former Czechoslovakia", $compcountry);
$compcountry = preg_replace("/^SU$/", "Former USSR", $compcountry);
$compcountry = preg_replace("/^FR$/", "France", $compcountry);
$compcountry = preg_replace("/^FX$/", "France (European Territory)", $compcountry);
$compcountry = preg_replace("/^GF$/", "French Guyana", $compcountry);
$compcountry = preg_replace("/^TF$/", "French Southern Territories", $compcountry);
$compcountry = preg_replace("/^GA$/", "Gabon", $compcountry);
$compcountry = preg_replace("/^GM$/", "Gambia", $compcountry);
$compcountry = preg_replace("/^GE$/", "Georgia", $compcountry);
$compcountry = preg_replace("/^DE$/", "Germany", $compcountry);
$compcountry = preg_replace("/^GH$/", "Ghana", $compcountry);
$compcountry = preg_replace("/^GI$/", "Gibraltar", $compcountry);
$compcountry = preg_replace("/^GB$/", "Great Britain", $compcountry);
$compcountry = preg_replace("/^GR$/", "Greece", $compcountry);
$compcountry = preg_replace("/^GL$/", "Greenland", $compcountry);
$compcountry = preg_replace("/^GD$/", "Grenada", $compcountry);
$compcountry = preg_replace("/^GP$/", "Guadeloupe (French)", $compcountry);
$compcountry = preg_replace("/^GU$/", "Guam (USA)", $compcountry);
$compcountry = preg_replace("/^GT$/", "Guatemala", $compcountry);
$compcountry = preg_replace("/^GN$/", "Guinea", $compcountry);
$compcountry = preg_replace("/^GW$/", "Guinea Bissau", $compcountry);
$compcountry = preg_replace("/^GY$/", "Guyana", $compcountry);
$compcountry = preg_replace("/^HT$/", "Haiti", $compcountry);
$compcountry = preg_replace("/^HM$/", "Heard and McDonald Islands", $compcountry);
$compcountry = preg_replace("/^HN$/", "Honduras", $compcountry);
$compcountry = preg_replace("/^HK$/", "Hong Kong", $compcountry);
$compcountry = preg_replace("/^HU$/", "Hungary", $compcountry);
$compcountry = preg_replace("/^IS$/", "Iceland", $compcountry);
$compcountry = preg_replace("/^IN$/", "India", $compcountry);
$compcountry = preg_replace("/^ID$/", "Indonesia", $compcountry);
$compcountry = preg_replace("/^INT$/", "International", $compcountry);
$compcountry = preg_replace("/^IR$/", "Iran", $compcountry);
$compcountry = preg_replace("/^IQ$/", "Iraq", $compcountry);
$compcountry = preg_replace("/^IE$/", "Ireland", $compcountry);
$compcountry = preg_replace("/^IL$/", "Israel", $compcountry);
$compcountry = preg_replace("/^IT$/", "Italy", $compcountry);
$compcountry = preg_replace("/^CI$/", "Ivory Coast (Cote D'Ivoire)", $compcountry);
$compcountry = preg_replace("/^JM$/", "Jamaica", $compcountry);
$compcountry = preg_replace("/^JP$/", "Japan", $compcountry);
$compcountry = preg_replace("/^JO$/", "Jordan", $compcountry);
$compcountry = preg_replace("/^KZ$/", "Kazakhstan", $compcountry);
$compcountry = preg_replace("/^KE$/", "Kenya", $compcountry);
$compcountry = preg_replace("/^KI$/", "Kiribati", $compcountry);
$compcountry = preg_replace("/^KW$/", "Kuwait", $compcountry);
$compcountry = preg_replace("/^KG$/", "Kyrgyzstan", $compcountry);
$compcountry = preg_replace("/^LA$/", "Laos", $compcountry);
$compcountry = preg_replace("/^LV$/", "Latvia", $compcountry);
$compcountry = preg_replace("/^LB$/", "Lebanon", $compcountry);
$compcountry = preg_replace("/^LS$/", "Lesotho", $compcountry);
$compcountry = preg_replace("/^LR$/", "Liberia", $compcountry);
$compcountry = preg_replace("/^LY$/", "Libya", $compcountry);
$compcountry = preg_replace("/^LI$/", "Liechtenstein", $compcountry);
$compcountry = preg_replace("/^LT$/", "Lithuania", $compcountry);
$compcountry = preg_replace("/^LU$/", "Luxembourg", $compcountry);
$compcountry = preg_replace("/^MO$/", "Macau", $compcountry);
$compcountry = preg_replace("/^MK$/", "Macedonia", $compcountry);
$compcountry = preg_replace("/^MG$/", "Madagascar", $compcountry);
$compcountry = preg_replace("/^MW$/", "Malawi", $compcountry);
$compcountry = preg_replace("/^MY$/", "Malaysia", $compcountry);
$compcountry = preg_replace("/^MV$/", "Maldives", $compcountry);
$compcountry = preg_replace("/^ML$/", "Mali", $compcountry);
$compcountry = preg_replace("/^MT$/", "Malta", $compcountry);
$compcountry = preg_replace("/^MH$/", "Marshall Islands", $compcountry);
$compcountry = preg_replace("/^MQ$/", "Martinique (French)", $compcountry);
$compcountry = preg_replace("/^MR$/", "Mauritania", $compcountry);
$compcountry = preg_replace("/^MU$/", "Mauritius", $compcountry);
$compcountry = preg_replace("/^YT$/", "Mayotte", $compcountry);
$compcountry = preg_replace("/^MX$/", "Mexico", $compcountry);
$compcountry = preg_replace("/^FM$/", "Micronesia", $compcountry);
$compcountry = preg_replace("/^MD$/", "Moldavia", $compcountry);
$compcountry = preg_replace("/^MC$/", "Monaco", $compcountry);
$compcountry = preg_replace("/^MN$/", "Mongolia", $compcountry);
$compcountry = preg_replace("/^MS$/", "Montserrat", $compcountry);
$compcountry = preg_replace("/^MA$/", "Morocco", $compcountry);
$compcountry = preg_replace("/^MZ$/", "Mozambique", $compcountry);
$compcountry = preg_replace("/^MM$/", "Myanmar", $compcountry);
$compcountry = preg_replace("/^NA$/", "Namibia", $compcountry);
$compcountry = preg_replace("/^NR$/", "Nauru", $compcountry);
$compcountry = preg_replace("/^NP$/", "Nepal", $compcountry);
$compcountry = preg_replace("/^NL$/", "Netherlands", $compcountry);
$compcountry = preg_replace("/^AN$/", "Netherlands Antilles", $compcountry);
$compcountry = preg_replace("/^NT$/", "Neutral Zone", $compcountry);
$compcountry = preg_replace("/^NC$/", "New Caledonia (French)", $compcountry);
$compcountry = preg_replace("/^NZ$/", "New Zealand", $compcountry);
$compcountry = preg_replace("/^NI$/", "Nicaragua", $compcountry);
$compcountry = preg_replace("/^NE$/", "Niger", $compcountry);
$compcountry = preg_replace("/^NG$/", "Nigeria", $compcountry);
$compcountry = preg_replace("/^NU$/", "Niue", $compcountry);
$compcountry = preg_replace("/^NF$/", "Norfolk Island", $compcountry);
$compcountry = preg_replace("/^KP$/", "North Korea", $compcountry);
$compcountry = preg_replace("/^MP$/", "Northern Mariana Islands", $compcountry);
$compcountry = preg_replace("/^NO$/", "Norway", $compcountry);
$compcountry = preg_replace("/^OM$/", "Oman", $compcountry);
$compcountry = preg_replace("/^PK$/", "Pakistan", $compcountry);
$compcountry = preg_replace("/^PW$/", "Palau", $compcountry);
$compcountry = preg_replace("/^PA$/", "Panama", $compcountry);
$compcountry = preg_replace("/^PG$/", "Papua New Guinea", $compcountry);
$compcountry = preg_replace("/^PY$/", "Paraguay", $compcountry);
$compcountry = preg_replace("/^PE$/", "Peru", $compcountry);
$compcountry = preg_replace("/^PH$/", "Philippines", $compcountry);
$compcountry = preg_replace("/^PN$/", "Pitcairn Island", $compcountry);
$compcountry = preg_replace("/^PL$/", "Poland", $compcountry);
$compcountry = preg_replace("/^PF$/", "Polynesia (French)", $compcountry);
$compcountry = preg_replace("/^PT$/", "Portugal", $compcountry);
$compcountry = preg_replace("/^PR$/", "Puerto Rico", $compcountry);
$compcountry = preg_replace("/^QA$/", "Qatar", $compcountry);
$compcountry = preg_replace("/^RE$/", "Reunion (French)", $compcountry);
$compcountry = preg_replace("/^RO$/", "Romania", $compcountry);
$compcountry = preg_replace("/^RU$/", "Russian Federation", $compcountry);
$compcountry = preg_replace("/^RW$/", "Rwanda", $compcountry);
$compcountry = preg_replace("/^GS$/", "S. Georgia & S. Sandwich Isls.", $compcountry);
$compcountry = preg_replace("/^SH$/", "Saint Helena", $compcountry);
$compcountry = preg_replace("/^KN$/", "Saint Kitts & Nevis Anguilla", $compcountry);
$compcountry = preg_replace("/^LC$/", "Saint Lucia", $compcountry);
$compcountry = preg_replace("/^PM$/", "Saint Pierre and Miquelon", $compcountry);
$compcountry = preg_replace("/^ST$/", "Saint Tome (Sao Tome) and Principe", $compcountry);
$compcountry = preg_replace("/^VC$/", "Saint Vincent & Grenadines", $compcountry);
$compcountry = preg_replace("/^WS$/", "Samoa", $compcountry);
$compcountry = preg_replace("/^SM$/", "San Marino", $compcountry);
$compcountry = preg_replace("/^SA$/", "Saudi Arabia", $compcountry);
$compcountry = preg_replace("/^SN$/", "Senegal", $compcountry);
$compcountry = preg_replace("/^SC$/", "Seychelles", $compcountry);
$compcountry = preg_replace("/^SL$/", "Sierra Leone", $compcountry);
$compcountry = preg_replace("/^SG$/", "Singapore", $compcountry);
$compcountry = preg_replace("/^SK$/", "Slovak Republic", $compcountry);
$compcountry = preg_replace("/^SI$/", "Slovenia", $compcountry);
$compcountry = preg_replace("/^SB$/", "Solomon Islands", $compcountry);
$compcountry = preg_replace("/^SO$/", "Somalia", $compcountry);
$compcountry = preg_replace("/^ZA$/", "South Africa", $compcountry);
$compcountry = preg_replace("/^KR$/", "South Korea", $compcountry);
$compcountry = preg_replace("/^ES$/", "Spain", $compcountry);
$compcountry = preg_replace("/^LK$/", "Sri Lanka", $compcountry);
$compcountry = preg_replace("/^SD$/", "Sudan", $compcountry);
$compcountry = preg_replace("/^SR$/", "Suriname", $compcountry);
$compcountry = preg_replace("/^SJ$/", "Svalbard and Jan Mayen Islands", $compcountry);
$compcountry = preg_replace("/^SZ$/", "Swaziland", $compcountry);
$compcountry = preg_replace("/^SE$/", "Sweden", $compcountry);
$compcountry = preg_replace("/^CH$/", "Switzerland", $compcountry);
$compcountry = preg_replace("/^SY$/", "Syria", $compcountry);
$compcountry = preg_replace("/^TJ$/", "Tadjikistan", $compcountry);
$compcountry = preg_replace("/^TW$/", "Taiwan", $compcountry);
$compcountry = preg_replace("/^TZ$/", "Tanzania", $compcountry);
$compcountry = preg_replace("/^TH$/", "Thailand", $compcountry);
$compcountry = preg_replace("/^TG$/", "Togo", $compcountry);
$compcountry = preg_replace("/^TK$/", "Tokelau", $compcountry);
$compcountry = preg_replace("/^TO$/", "Tonga", $compcountry);
$compcountry = preg_replace("/^TT$/", "Trinidad and Tobago", $compcountry);
$compcountry = preg_replace("/^TN$/", "Tunisia", $compcountry);
$compcountry = preg_replace("/^TR$/", "Turkey", $compcountry);
$compcountry = preg_replace("/^TM$/", "Turkmenistan", $compcountry);
$compcountry = preg_replace("/^TC$/", "Turks and Caicos Islands", $compcountry);
$compcountry = preg_replace("/^TV$/", "Tuvalu", $compcountry);
$compcountry = preg_replace("/^UG$/", "Uganda", $compcountry);
$compcountry = preg_replace("/^UA$/", "Ukraine", $compcountry);
$compcountry = preg_replace("/^AE$/", "United Arab Emirates", $compcountry);
$compcountry = preg_replace("/^GB$/", "United Kingdom", $compcountry);
$compcountry = preg_replace("/^UY$/", "Uruguay", $compcountry);
$compcountry = preg_replace("/^MIL$/", "USA Military", $compcountry);
$compcountry = preg_replace("/^UM$/", "USA Minor Outlying Islands", $compcountry);
$compcountry = preg_replace("/^UZ$/", "Uzbekistan", $compcountry);
$compcountry = preg_replace("/^VU$/", "Vanuatu", $compcountry);
$compcountry = preg_replace("/^VA$/", "Vatican City State", $compcountry);
$compcountry = preg_replace("/^VE$/", "Venezuela", $compcountry);
$compcountry = preg_replace("/^VN$/", "Vietnam", $compcountry);
$compcountry = preg_replace("/^VG$/", "Virgin Islands (British)", $compcountry);
$compcountry = preg_replace("/^VI$/", "Virgin Islands (USA)", $compcountry);
$compcountry = preg_replace("/^WF$/", "Wallis and Futuna Islands", $compcountry);
$compcountry = preg_replace("/^EH$/", "Western Sahara", $compcountry);
$compcountry = preg_replace("/^YE$/", "Yemen", $compcountry);
$compcountry = preg_replace("/^YU$/", "Yugoslavia", $compcountry);
$compcountry = preg_replace("/^ZR$/", "Zaire", $compcountry);
$compcountry = preg_replace("/^ZM$/", "Zambia", $compcountry);
$compcountry = preg_replace("/^ZW$/", "Zimbabwe", $compcountry);
if (preg_match("/platinum/i", $comppackage)) { $status = "platinum"; }
if (preg_match("/gold/i", $comppackage)) { $status = "gold"; }
if (preg_match("/^1$/i", $compenhanced)) { $status = "enhanced"; }
if (preg_match("/platinum|gold/i", $status)) {
if($imagelarge){$content .= ' ';}
}
$content .= ' '.$compaddress01.' '.$compaddress02.' '.$compcity.' ';
if($compstate){$content .= '
, '.$compstate.' '.$comzip.' ';}
if($compcountry){$content .= '
'.$compcountry.' ';}
$content .= '
';
if($compphone){$content .= '
Phone: '.$compphone.' ';}
if($comptollfreephone){$content .= '
Toll Free Phone: '.$comptollfreephone.' ';}
if($compfax){$content .= '
Fax: '.$compfax.'';}
if($compwebsite){
if (preg_match("/platinum|gold|enhanced/i", $status)) {$content .= '
'.$compwebsite.' ';}
else{$content .= '
'.$compwebsite.'';}
}
if($compcertificationtype){$content .= '
Certification Type: '.$compcertificationtype.' ';}
if($compregionsserved){$content .= '
Regions Served*: '.$compregionsserved.' ';}
$content .= '
';
$content .= '
';
$content .= '
';
if (preg_match("/platinum|gold/i", $status)) {
if($companydescription){
$content .= '
';
$content .= ' ';
$content .= '
';
$content .= ' ';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= '
';
}
}
if($contactfirstname){
$content .= '
';
$content .= ' ';
$content .= '
';
$content .= ' ';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' '.$contactfirstname.' '.$contactlastname.'
';
$content .= ' ';
$content .= '
';
}
if (preg_match("/platinum|gold/i", $status)) {
$content .= '
';
$content .= '
';
$content .= '
';
if($productlines){$content .= '
'.$productlines.'
';}
else{$content .= '
At this time, there are no product lines to display.
';}
$content .= '
';
$content .= '
';
if($manufacturerreps){$content .= '
'.$manufacturerreps.'
';}
else{$content .= '
At this time, there are no manufacturer reps to display.
';}
$content .= '
';
$content .= '
';
if($territories){$content .= '
'.$territories.'
';}
else{$content .= '
At this time, there are no territories to display.
';}
$content .= '
';
$content .= '
';
if($distributors){$content .= '
'.$distributors.'
';}
else{$content .= '
At this time, there are no distributors to display.
';}
$content .= '
';
$content .= '
';
if($additionallocations){$content .= '
'.$additionallocations.'
';}
else{$content .= '
At this time, there are no additional locations to display.
';}
$content .= '
';
$content .= '
';
}
}
$content .= '
';
$content .= ' ';
$content .= '
';
$content .= '
';
$queryc = mysql_query("SELECT * FROM `compcats` WHERE `CompanyID` = '$compid' ORDER BY `CategoryName`");
while($s=mysql_fetch_array($queryc))
{
$companyid=$s["CompanyID"];
$catid=$s["CategoryID"];
$queryd = mysql_query("SELECT * FROM `categories` WHERE `id` = '$catid'");
while($t=mysql_fetch_array($queryd))
{
$categoryname=$t["CategoryName"];
$categoryalias=$t["CategoryAlias"];
$categoryid=$t["id"];
$categorylevel=$t["Level"];
$categoryparent=$t["ParentID"];
if (preg_match("/^2$/", $categoryid)){$bmfilmstop = ' ';}
if (preg_match("/^2$/", $categoryparent)){$bmfilmssub .= ' ';}
if (preg_match("/^34$/", $categoryid)){$bmfoilstop = ' ';}
if (preg_match("/^34$/", $categoryparent)){$bmfoilssub .= ' ';}
if (preg_match("/^38$/", $categoryid)){$bmpapertop = ' ';}
if (preg_match("/^38$/", $categoryparent)){$bmpapersub .= ' ';}
if (preg_match("/^53$/", $categoryid)){$equiptop = ' ';}
if (preg_match("/^53$/", $categoryparent)){$equipsub .= ' ';}
if (preg_match("/^254$/", $categoryid)){$suppliestop = ' ';}
if (preg_match("/^254$/", $categoryparent)){$suppliessub .= ' ';}
}
}
$content .= $bmfilmstop.$bmfilmssub.$bmfoilstop.$bmfoilssub.$bmpapertop.$bmpapersub.$equiptop.$equipsub.$suppliestop.$suppliessub;
$content .= '
';
$content .= '
';
if($compregionsserved){$content .= '
*Regions Served Key:
AF= Africa & Middle East, AS = Asia, EU = Europe, LA = Latin America, NA = North America, SP = South Pacific & Pacific Rim
';}
}
$addthis .= '';
$addthis .= '
';
$addthis .= '
';
$addthis .= '';
$addthis .= '
';
$addthis .= '';
$title = $compname . ' | PFFC Online Buyers Guide';
$breadcrumbs = '
PFFC Online Buyers Guide » ' . $compname;
$cattop = '
';
//$catbottom = '
';
$template = file_get_contents('https://directory.pffc-online.com/templates/template2.html');
if((preg_match("/platinum/i", $comppackage))&&($companydescription)){$metaplustags = $companydescription; $metadescription = strip_tags($metaplustags); $metadescription = str_replace(chr(10), '', str_replace(chr(13), '', $metadescription));}
else{$metadescription = $compname.' '.$compaddress01.' '.$compaddress02.' '.$compcity.' '.$compstate.' '.$compcountry;}
$template = preg_replace("/
/", "
", $template);
$template = preg_replace("//", "$title", $template);
$template = preg_replace("//", "$breadcrumbs", $template);
$template = preg_replace("//", "$addthis", $template);
$template = preg_replace("/.*/is", "", $template);
$template = preg_replace("//", "$cattop$content$catbottom", $template);
$template = preg_replace("//", "$videocode", $template);
echo $template;
}///// end function comppage
////
function alpha($alpha,$limit,$start,$page){
if (preg_match("/^all$/", $alpha)){
if(!$limit){$limit = "100";}
}
else{
if(!$limit){$limit = "20";}
}
if(!$start){$start = "0";}
//how many items to show per page
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else{
$start = 0;
}
if (preg_match("/all/", $alpha)){
$viewall = "all";
$query = mysql_query("SELECT * FROM `companies` ORDER BY `CompanyName` LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies`");
}
else{
$query = mysql_query("SELECT * FROM `companies` WHERE SUBSTRING(CompanyName, 1, 1) = '$alpha' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE SUBSTRING(CompanyName, 1, 1) = '$alpha' ORDER BY `Package` DESC, `CompanyName` ASC");
}
if(mysql_num_rows($query) == 0) {
$emptymessage = '
No matches found
';
}
else{
$compmatches = mysql_num_rows($querynav);
while($r=mysql_fetch_array($query))
{
$companyid=$r["id"];
$companyname=$r["CompanyName"];
$companyalias=$r["Alias"];
$companyaddress01=$r["PublishedAddress01"];
$companyaddress02=$r["PublishedAddress02"];
$city=$r["PublishedCity"];
$state=$r["PublishedState"];
$zip=$r["PublishedZip"];
$country=$r["PublishedCountry"];
$imagesmall=$r["ImageSmall"];
$package=$r["Package"];
if($viewall){
$contentall .= '
';
$contentall .= '';
$contentall .= '
';
$contentall .= '
';
$contentall .= ' ';
$contentall .= ' ';
$contentall .= ' '.$companyname.' ';
$contentall .= ' ';
$contentall .= ' ';
$contentall .= '
';
$contentall .= '';
$contentall .= '
';
}
else{
if (preg_match("/platinum/i", $package)) {
$content .= '
';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
if($imagesmall){$content .= ' ';}
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/gold/i", $package)) {
$content .= '
';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/basic/i", $package)) {
$content .= '
';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
}
}
$alphaupper = strtoupper($alpha);
if($viewall){$content = $contentall;}
else{$content = $content;}
}
if($viewall){$title = 'Company Index | PFFC Online Buyers Guide';}
else{$title = 'Search results for ' . $alphaupper . ' | PFFC Online Buyers Guide';}
if($viewall){$breadcrumbs = '
PFFC Online Buyers Guide » Company Index';}
else{$breadcrumbs = '
PFFC Online Buyers Guide » Search Results for "' . $alphaupper . '"';}
if($viewall){$cattop = '
Company Index
'.$compmatches.' Companies
';}
else{$cattop = '
Search results for "'.$alphaupper.'"
Results: '.$compmatches.' Companies
';}
if($viewall){
$cattop .= '
';
}
if(!$viewall){
$cattop .= '
';
}
if($viewall){
$pagination = getPaginationString($page, $compmatches, $limit, '3', 'index.html', '?alpha=all&limit='.$limit.'&page=');
}
else{
$pagination = getPaginationString($page, $compmatches, $limit, '5', 'index.html', '?alpha='.$alphaupper.'&limit='.$limit.'&page=');
}
$cattop .= '
';
$cattop = preg_replace('/option value="'.$limit.'"/', 'option value="'.$limit.'" selected="selected"', $cattop);
$template = file_get_contents('https://directory.pffc-online.com/templates/template2.html');
$template = preg_replace("//", "$title", $template);
$template = preg_replace("//", "$breadcrumbs", $template);
$template = preg_replace("//", "$cattop$content$catbottom$pagination", $template);
echo $template;
}///// end function alpha
////
function searchpage($searchcity,$searchstate,$searchcountry,$searchzip,$limit,$start,$page){
$searchcity = preg_replace("/%20/", " ", $searchcity);
$searchcountry = preg_replace("/UK/", "GB", $searchcountry); // needs to be same in db and form
if(!$limit){$limit = "20";}
if(!$start){$start = "0";}
//how many items to show per page
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else{
$start = 0;
}
if($searchzip){
$query = mysql_query("SELECT * FROM `companies` WHERE `PublishedZip` = '$searchzip' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE `PublishedZip` = '$searchzip'");
$navmatches = mysql_num_rows($querynav);
}
if(($searchcity)&&(!$searchstate)&&(!$searchcountry)){
$query = mysql_query("SELECT * FROM `companies` WHERE `PublishedCity` LIKE '%$searchcity%' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE `PublishedCity` LIKE '%$searchcity%'");
$navmatches = mysql_num_rows($querynav);
}
if((!$searchcity)&&($searchstate)&&(!$searchcountry)){
$query = mysql_query("SELECT * FROM `companies` WHERE `PublishedState` = '$searchstate' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE `PublishedState` = '$searchstate'");
$navmatches = mysql_num_rows($querynav);
}
if((!$searchcity)&&(!$searchstate)&&($searchcountry)){
$query = mysql_query("SELECT * FROM `companies` WHERE `PublishedCountry` = '$searchcountry' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE `PublishedCountry` = '$searchcountry'");
$navmatches = mysql_num_rows($querynav);
}
if(($searchcity)&&($searchstate)&&(!$searchcountry)){
$query = mysql_query("SELECT * FROM `companies` WHERE `PublishedCity` LIKE '%$searchcity%' AND `PublishedState` = '$searchstate' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE `PublishedCity` LIKE '%$searchcity%' AND `PublishedState` = '$searchstate'");
$navmatches = mysql_num_rows($querynav);
}
if(($searchcity)&&(!$searchstate)&&($searchcountry)){
$query = mysql_query("SELECT * FROM `companies` WHERE `PublishedCity` LIKE '%$searchcity%' AND `PublishedCountry` = '$searchcountry' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE `PublishedCity` LIKE '%$searchcity%' AND `PublishedCountry` = '$searchcountry'");
$navmatches = mysql_num_rows($querynav);
}
if((!$searchcity)&&($searchstate)&&($searchcountry)){
$query = mysql_query("SELECT * FROM `companies` WHERE `PublishedState` = '$searchstate' AND `PublishedCountry` = '$searchcountry' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE `PublishedState` = '$searchstate' AND `PublishedCountry` = '$searchcountry'");
$navmatches = mysql_num_rows($querynav);
}
if(($searchcity)&&($searchstate)&&($searchcountry)){
$query = mysql_query("SELECT * FROM `companies` WHERE `PublishedCity` LIKE '%$searchcity%' AND `PublishedState` = '$searchstate' AND `PublishedCountry` = '$searchcountry' ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE `PublishedCity` LIKE '%$searchcity%' AND `PublishedState` = '$searchstate' AND `PublishedCountry` = '$searchcountry'");
$navmatches = mysql_num_rows($querynav);
}
if(mysql_num_rows($query) == 0) {
$emptymessage = '
No matches found
';
}
else{
while($r=mysql_fetch_array($query))
{
$companyid=$r["id"];
$companyname=$r["CompanyName"];
$companyalias=$r["Alias"];
$companyaddress01=$r["PublishedAddress01"];
$companyaddress02=$r["PublishedAddress02"];
$city=$r["PublishedCity"];
$state=$r["PublishedState"];
$zip=$r["PublishedZip"];
$country=$r["PublishedCountry"];
$imagesmall=$r["ImageSmall"];
$package=$r["Package"];
if (preg_match("/platinum/i", $package)) {
$content .= '
';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
if($imagesmall){$content .= ' ';}
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/gold/i", $package)) {
$content .= '
';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/basic/i", $package)) {
$content .= '
';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
}
}
if($emptymessage){$content = $emptymessage;}
else{$content = $content;}
$title = 'Search Results | PFFC Online Buyers Guide';
$breadcrumbs = '
PFFC Online Buyers Guide » Search Results';
if(!$emptymessage){
$cattop = '
Results: '.$navmatches.' Companies
';
$cattop .= '
';
}
else{
$cattop = '
';
}
$cattop .= '
';
$cattop = preg_replace('/option value="'.$limit.'"/', 'option value="'.$limit.'" selected="selected"', $cattop);
if($searchzip){
$pagination = getPaginationString($page, $navmatches, $limit, '5', 'index.html', '?searchzip='.$searchzip.'&limit='.$limit.'&page=');
}
else{
$pagination = getPaginationString($page, $navmatches, $limit, '3', 'index.html', '?searchcity='.$searchcity.'&searchstate='.$searchstate.'&searchcountry='.$searchcountry.'&limit='.$limit.'&page=');
}
$template = file_get_contents('https://directory.pffc-online.com/templates/template2.html');
$template = preg_replace("//", "$title", $template);
$template = preg_replace("//", "$breadcrumbs", $template);
$template = preg_replace("//", "$cattop$content$catbottom$pagination", $template);
echo $template;
}///// end function searchpage
////
function searchkeyword($keywords,$directorytype,$limit,$start,$page){
$keywords = trim($keywords);
$keylength = strlen($keywords);
if(!$limit){$limit = "20";}
if(!$start){$start = "0";}
//how many items to show per page
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else{
$start = 0;
}
if (preg_match("/SearchCompanies/", $directorytype)){
$word=split(" ",$keywords);
while(list($key,$val)=each($word)){
if($val<>" " and strlen($val) > 0){$q .= " `CompanyName` LIKE '%$val%' AND ";}
}
$q=substr($q,0,(strlen($q)-4));
$query = mysql_query("SELECT * FROM `companies` WHERE $q ORDER BY `Package` DESC, `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `companies` WHERE $q");
$navmatches = mysql_num_rows($querynav);
if((mysql_num_rows($query) == 0)||($keylength<'2')) {
if($keylength<'2'){$emptymessage = '
Please make sure your search string contains at least two characters.
';}
else{$emptymessage = '
There are no companies that match your search. Please search again.
';}
}
else{
while($r=mysql_fetch_array($query))
{
$companyid=$r["id"];
$companyname=$r["CompanyName"];
$companyalias=$r["Alias"];
$companyaddress01=$r["PublishedAddress01"];
$companyaddress02=$r["PublishedAddress02"];
$city=$r["PublishedCity"];
$state=$r["PublishedState"];
$zip=$r["PublishedZip"];
$country=$r["PublishedCountry"];
$imagesmall=$r["ImageSmall"];
$package=$r["Package"];
if (preg_match("/platinum/i", $package)) {
$content .= '
';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
if($imagesmall){$content .= ' ';}
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/gold/i", $package)) {
$content .= '
';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/basic/i", $package)) {
$content .= '
';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
}
}
if($emptymessage){$content = $emptymessage;}
else{$content = $content;}
$title = 'Company Search Results | PFFC Online Buyers Guide';
$breadcrumbs = '
PFFC Online Buyers Guide » Company Search Results';
if(!$emptymessage){
$cattop = '
Search Results for "'.$keywords.'"
Results: '.$navmatches.' Companies
';
$cattop .= '
';
$pagination = getPaginationString($page, $navmatches, $limit, '5', 'index.html', '?keyword='.$keywords.'&directorytype='.$directorytype.'&limit='.$limit.'&page=');
}
else{
$cattop = '
Search Results for "'.$keywords.'"
';
}
//$pagination = getPaginationString($page, $navmatches, $limit, '5', 'index.html', '?keyword='.$keywords.'&directorytype='.$directorytype.'&limit='.$limit.'&page=');
$cattop .= '
';
$cattop = preg_replace('/option value="'.$limit.'"/', 'option value="'.$limit.'" selected="selected"', $cattop);
$template = file_get_contents('https://directory.pffc-online.com/templates/template2.html');
$template = preg_replace("//", "$title", $template);
$template = preg_replace("//", "$breadcrumbs", $template);
$template = preg_replace("//", "$cattop$content$catbottom$pagination", $template);
$template = preg_replace('/
/', ' ', $template);
echo $template;
}/// end if search companies
if (preg_match("/SearchAssociations/", $directorytype)){
$word=split(" ",$keywords);
while(list($key,$val)=each($word)){
if($val<>" " and strlen($val) > 0){$q .= " `CompanyName` LIKE '%$val%' AND";}
}
//$q=substr($q,0,(strlen($q)-4));
if($keywords == " "){$q = "";}
$queryb = mysql_query("SELECT * FROM `compcats` WHERE $q `CategoryID` = '508' ORDER BY `CompanyName` ASC LIMIT $start, $limit");
$querynav = mysql_query("SELECT * FROM `compcats` WHERE $q `CategoryID` = '508'");
//if((mysql_num_rows($queryb) == 0)||($keylength<'2')) {
if(mysql_num_rows($queryb) == 0) {
if($keylength<'2'){$emptymessage = 'Please make sure your search string contains at least two characters.
';}
else{$emptymessage = 'There are no associations that match your search. Please search again.
';}
}
else{
$navmatches = mysql_num_rows($querynav);
while($s=mysql_fetch_array($queryb))
{
$companyidb=$s["CompanyID"];
$query = mysql_query("SELECT * FROM `companies` WHERE `id` = '$companyidb'");
while($r=mysql_fetch_array($query))
{
$companyid=$r["id"];
$companyname=$r["CompanyName"];
$companyalias=$r["Alias"];
$companyaddress01=$r["PublishedAddress01"];
$companyaddress02=$r["PublishedAddress02"];
$city=$r["PublishedCity"];
$state=$r["PublishedState"];
$zip=$r["PublishedZip"];
$country=$r["PublishedCountry"];
$imagesmall=$r["ImageSmall"];
$package=$r["Package"];
if (preg_match("/platinum/i", $package)) {
$content .= '';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
if($imagesmall){$content .= ' ';}
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/gold/i", $package)) {
$content .= '';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
if (preg_match("/basic/i", $package)) {
$content .= '';
$content .= '';
$content .= '
';
$content .= '
';
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= ' ';
$content .= ' '.$companyname.' ';
$content .= ' '.$city;
if($state){$content .= ', '. $state;}
$content .= '
';
$content .= ' ';
$content .= ' ';
$content .= '
';
$content .= '';
$content .= '
';
}
}
}//else
}
if($emptymessage){$content = $emptymessage;}
else{$content = $content;}
$title = 'Association Search Results | PFFC Online Buyers Guide';
$breadcrumbs = 'PFFC Online Buyers Guide » Association Search Results';
if(!$emptymessage){
if(!$keywords){
$cattop = 'Search Results
Results: '.$navmatches.' Association(s)
';
}
else{
$cattop = 'Search Results for "'.$keywords.'"
Results: '.$navmatches.' Association(s)
';
}
$cattop .= '
';
$pagination = getPaginationString($page, $navmatches, $limit, '5', 'index.html', '?keyword='.$keywords.'&directorytype='.$directorytype.'&limit='.$limit.'&page=');
}
else{
$cattop = 'Search Results for "'.$keywords.'"
';
}
//$pagination = getPaginationString($page, $navmatches, $limit, '5', 'index.html', '?keyword='.$keywords.'&directorytype='.$directorytype.'&limit='.$limit.'&page=');
$cattop .= ' ';
$cattop = preg_replace('/option value="'.$limit.'"/', 'option value="'.$limit.'" selected="selected"', $cattop);
$template = file_get_contents('https://directory.pffc-online.com/templates/template2.html');
$template = preg_replace("//", "$title", $template);
$template = preg_replace("//", "$breadcrumbs", $template);
$template = preg_replace("//", "$cattop$content$catbottom$pagination", $template);
$template = preg_replace('/ /', ' ', $template);
echo $template;
}/// end if search associations
if (preg_match("/SearchCategories/", $directorytype)){
$word=split(" ",$keywords);
while(list($key,$val)=each($word)){
if($val<>" " and strlen($val) > 0){$q .= " `CategoryName` LIKE '%$val%' AND ";}
}
$q=substr($q,0,(strlen($q)-4));
//echo $q.' ';
$query = mysql_query("SELECT * FROM `categories` WHERE $q ORDER BY `CategoryName`");
if((mysql_num_rows($query) == 0)||($keylength<'2')) {
if($keylength<'2'){$emptymessage = 'Please make sure your search string contains at least two characters.
';}
else{$emptymessage = 'There are no categories that match your search. Please search again.
';}
}
else{
$matches = mysql_num_rows($query);
while($r=mysql_fetch_array($query))
{
$catid=$r["id"];
$catname=$r["CategoryName"];
$catalias=$r["CategoryAlias"];
$catlevel=$r["Level"];
$catparent=$r["ParentID"];
$content .= ' ';
}
}
if($emptymessage){$content = $emptymessage;}
else{$content = $content;}
$title = 'Category Search Results | PFFC Online Buyers Guide';
$breadcrumbs = 'PFFC Online Buyers Guide » Category Search Results';
if(!$emptymessage){
$cattop = 'Search results for "'.$keywords.'"
Results: '.$matches.' Categories
';
}
else{
$cattop = 'Search results for "'.$keywords.'"
';
}
$cattop .= ' ';
$template = file_get_contents('https://directory.pffc-online.com/templates/template2.html');
$template = preg_replace("//", "$title", $template);
$template = preg_replace("//", "$breadcrumbs", $template);
$template = preg_replace("//", "$cattop$content$catbottom", $template);
echo $template;
}/// end if search categories
}///// end function searchkeyword
?>