switch($mode) {
case "add":
include ("functions.inc");
add_entry();
break;
case "edit":
include ("functions.inc");
edit_entry();
break;
case "save":
include ("functions.inc");
save_entry();
break;
case "delete":
include ("functions.inc");
delete_entry($id);
break;
}
?>
//Global Variables
$maxparentareas = 8;
$orderbysite = 1;
$orderalpha = 1;
$reclimit = 40;
if(!isset($parent_area) || $parent_area == '0:All Areas') {
$parent_area = '0:All Areas';
$child_area = '0:All Areas';
}
if($parent_area != '0:All Areas' && !isset($child_area)) {
$child_area = '0:All Areas';
}
if(!isset($category) || $category == '0:All Categories') {
$category = '0:All Categories';
}
if(!isset($websites) || $websites == '0:All Companies') {
$websites = '0:All Companies';
}
?>
Customize your search by setting your own parameters
Search by:
//Parent Combo Box - Do not modify!!
if(isset($parent_area) && !ereg("All Areas",$parent_area)) {
$area = split(":",$parent_area);
echo "$area[1] ";
} else {
echo "Geography,";
}
?>
Category,
or Web Sites
SELECT
if(!ereg("All Areas",$parent_area)) {
echo " ";
}
?>
All Categories
$catresult=mysql_db_query('v3033','select * from dir_categories',$link);
while($catrow=mysql_fetch_row($catresult)) {
$cat = split(":",$category);
if($cat[1] == $catrow[1]) {
echo " $catrow[1]\n";
} else {
echo " $catrow[1]\n";
}
}
?>
>All Companies
>Companies with Web Sites
>Companies without Web Sites
After making your selections, hit the search button below- companies with web sites are prioritized
if(isset($parent_area)) {
$parent_index = split(":",$parent_area);
$parentidx = $parent_index[0];
}
if(isset($child_area)) {
$child_index = split(":",$child_area);
$childidx = $child_index[0];
}
if(isset($category)) {
$catindex = split(":",$category);
$catidx = $catindex[0];
}
if(isset($websites)) {
$webindex = split(":",$websites);
$webidx = $webindex[0];
}
if($parentidx != 0) {
$where = " where parent_area = $parentidx";
$first = 1;
} else {
$first = 0;
}
if($childidx != 0) {
if($first == 1) {
$where = $where." && child_area = $childidx";
} else {
$where = "where child_area = $childidx";
$first = 1;
}
}
if($catidx != 0) {
if($first == 1) {
$where = $where." && category = $catidx";
} else {
$where = " where category = $catidx";
$first = 1;
}
}
if($webidx == 1) {
if($first == 1) {
$where = $where." && has_website = -1";
} else {
$where = " where has_website = -1";
$first = 1;
}
}
if($webidx == 2) {
if($first == 1) {
$where = $where." && has_website = 0";
} else {
$where = " where has_website = 0";
$first = 1;
}
}
$keywords = split(" ",$terms);
if(isset($keywords) && $terms != "") {
$i=0;
while($i < count($keywords)) {
if($where == "" || !isset($where)) {
$where = "where company like '%$keywords[$i]%' || comments like '%$keywords[$i]%'";
} else {
$where = $where." && (company like '%$keywords[$i]%' || comments like '%$keywords[$i]%')";
}
$i++;
}
}
if(!isset($start)) {
$start = 0;
}
$totresult=mysql_db_query('v3033',"select count(*) from dir_reg $where",$link);
if($orderbysite==1) {
if($orderalpha==1) {
$dirresult=mysql_db_query('v3033',"select * from dir_reg $where order by has_website,company limit $start,$reclimit",$link);
} else {
$dirresult=mysql_db_query('v3033',"select * from dir_reg $where order by has_website limit $start,$reclimit",$link);
}
} else {
if($orderalpha==1) {
$dirresult=mysql_db_query('v3033',"select * from dir_reg $where order by company limit $start,$reclimit",$link);
} else {
$dirresult=mysql_db_query('v3033',"select * from dir_reg $where limit $start,$reclimit",$link);
}
}
$recsfound = mysql_fetch_row($totresult);
$recsdisplayed = mysql_num_rows($dirresult);
if($search == 1 || $start > 0) {
?>
if($recsfound[0] > 0) {
?>
Found echo $recsfound[0]; ?> Records
Displaying Records echo $start; ?> to
if($recsfound[0] > 0 && ($reclimit + $start) < $recsfound[0]) {
echo $reclimit+$start;
} else {
if(($reclimit + $start) >= $recsfound[0]) {
echo $recsfound[0];
} else {
echo 0;
}
}
?>
$next = $start+$reclimit;
$prev = $start-$reclimit;
if($start > 0) {
$prevurl = "$PHP_SELF?parent_area=".urlencode($parent_area)."&child_area=".urlencode($child_area)."&category=".urlencode($category)."&websites=".urlencode($websites)."&start=".urlencode($prev)."&terms=".urlencode($terms)."&search=1";
echo "<< Previous ";
if(($reclimit + $start) < $recsfound[0]) {
$nexturl = "$PHP_SELF?parent_area=".urlencode($parent_area)."&child_area=".urlencode($child_area)."&category=".urlencode($category)."&websites=".urlencode($websites)."&start=".urlencode($next)."&terms=".urlencode($terms)."&search=1";
echo " Next >> ";
}
} else {
if(($reclimit + $start) < $recsfound[0]) {
$nexturl = "$PHP_SELF?parent_area=".urlencode($parent_area)."&child_area=".urlencode($child_area)."&category=".urlencode($category)."&websites=".urlencode($websites)."&start=".urlencode($next)."&terms=".urlencode($terms)."&search=1";
echo "Next >> ";
}
}
?>
} else {
echo "
";
}
?>
while($dir=mysql_fetch_row($dirresult)) {
$catrst=mysql_db_query('v3033',"select * from dir_categories where cat_id=$dir[12] limit 0,1",$link);
$catdesc = mysql_fetch_row($catrst);
echo "
$dir[2]
Contact
$dir[1]
Category
$catdesc[1]
Address
$dir[3]
City
$dir[4]
State/Province
$dir[5]
Country
$dir[18]
Zip/Postal Code
$dir[6]
Phone
$dir[7]
Fax
$dir[9]
Email Address
";
if($dir[11] != '') {
echo "$dir[11] ";
}
echo "
Web Site
";
if($dir[10] != '') {
echo "$dir[10] ";
}
echo "
Description
$dir[13]
Edit Entry
";
}
}
?>
if($search == 1 || $start > 0) {
echo "
";
if($recsfound[0] > 0) {
?>
Found echo $recsfound[0]; ?> Records
Displaying Records echo $start; ?> to
if($recsfound[0] > 0 && ($reclimit + $start) < $recsfound[0]) {
echo $reclimit+$start;
} else {
if(($reclimit + $start) >= $recsfound[0]) {
echo $recsfound[0];
} else {
echo 0;
}
}
?>
$next = $start+$reclimit;
$prev = $start-$reclimit;
if($start > 0) {
$prevurl = "$PHP_SELF?parent_area=".urlencode($parent_area)."&child_area=".urlencode($child_area)."&category=".urlencode($category)."&websites=".urlencode($websites)."&start=".urlencode($prev)."&terms=".urlencode($terms)."&search=1";
echo "<< Previous ";
if(($reclimit + $start) < $recsfound[0]) {
$nexturl = "$PHP_SELF?parent_area=".urlencode($parent_area)."&child_area=".urlencode($child_area)."&category=".urlencode($category)."&websites=".urlencode($websites)."&start=".urlencode($next)."&terms=".urlencode($terms)."&search=1";
echo " Next >> ";
}
} else {
if(($reclimit + $start) < $recsfound[0]) {
$nexturl = "$PHP_SELF?parent_area=".urlencode($parent_area)."&child_area=".urlencode($child_area)."&category=".urlencode($category)."&websites=".urlencode($websites)."&start=".urlencode($next)."&terms=".urlencode($terms)."&search=1";
echo "Next >> ";
}
}
}
}
?>