array( "info"=>array("id"=>-1,"name"=>"","description"=>""), "locations"=>array(), "categories"=>array() ), "premium"=>false, "expires"=>"Not Available" ); $_POST["listing"]["new"]=$_POST["listing"]["current"]; } if(!isset($_POST["listing"]["new"]["locations"])) $_POST["listing"]["new"]["locations"]=array(); if(!isset($_POST["listing"]["new"]["categories"])) $_POST["listing"]["new"]["categories"]=array(); if(!isset($_POST["listing"]["current"]["locations"])) $_POST["listing"]["current"]["locations"]=array(); if(!isset($_POST["listing"]["current"]["categories"])) $_POST["listing"]["current"]["categories"]=array(); //get required data require_once $_SERVER['DOCUMENT_ROOT']."/includes/dbi.inc"; $db=new Database(); $sqls=array(); $sqls["countries"]="select * from countries order by name"; $sqls["provinces"]="select * from prov_state order by name"; $sqls["business_types"]="select * from businesstypes order by name"; foreach($sqls as $sql_name=>$sql){ if(isset($_SESSION[$sql_name])){ $sqls[$sql_name]=$_SESSION[$sql_name]; } else { $sqls[$sql_name]=$db->get_data($sql,array("id"=>$_REQUEST["listing_id"])); $_SESSION[$sql_name]=$sqls[$sql_name]; } } if($_POST["listing"]["current"]["info"]["id"]==-1) $_POST["listing"]["premium"]=false; ?> Welcome to the Oil Directory - Your online resource for the oil & gas industry! '; ?>
Search Oildirectory
Business Name
Name:
Keyword:
EOD; } ?>
Please save your New Listing and then pay for your option through paypal on the next page."; $buttons=<< EOD; } else { $title="Edit Listing"; $header="

Please save your Edited Listing and then pay for your option through paypal on the next page.

"; $buttons=<< EOD; } //store all current information foreach($_POST["listing"]["current"]["info"] as $name=>$value){ $value=addslashes($value); print << EOD; } foreach($_POST["listing"]["current"]["locations"] as $id=>$info){ foreach($info as $name=>$value){ $value=addslashes($value); print << EOD; } } foreach($_POST["listing"]["current"]["categories"] as $id=>$value){ print << EOD; } print <<
$header
{$_SESSION["error"]}
Company Information
*Name:
*Description:
*Administrator Email (will be used to confirm changes to listing but will not be displayed in the listing):

Business Categories EOD; get_categories($sqls["business_types"],$_POST["listing"]["new"]["categories"],$all_categories,$include_categories); $new_cat_btn = ""; if($_REQUEST["is_admin"]=="true") $new_cat_btn = ""; print <<
All Categories {$new_cat_btn} *Include in Categories


{$buttons}
Location Information
EOD; $hidden_atr = ""; if (!isset($_REQUEST['is_admin']) || $_REQUEST['is_admin'] != true) { $hidden_atr = "hidden"; } //print location list $location_divs=array(); if(isset($_POST["listing"]["new"]["locations"])){ foreach($_POST["listing"]["new"]["locations"] as $locnum=>$info){ $province_options=get_options($info["province_id"],$sqls["provinces"]); $country_options=get_options($info["country_id"],$sqls["countries"]); $location_divs[]=<<
Edit Location #{$locnum}
Contact Name:
Address:
City:
*Province:
*Country:
Post/Zip Code:
*Phone:
Fax:
Cell:
Toll Free:
Email(s):
Website URL:

EOD; } } //print location divs print join("",$location_divs); print <<
EOD; ?>
To subscribe now for as low as $49.00/year, click on the subscribe button below
Payment Options
EOD; } //show premium window if necessary $show_upgrade=true; $show_premium=false; if(isset($_POST["listing"]["current"]["info"]["id"]) and $_POST["listing"]["current"]["info"]["id"]==-1) $show_upgrade=false; if(isset($_POST["listing"]["premium"]) and $_POST["listing"]["premium"]==true){ $show_upgrade=false; $show_premium=true; } if ($_REQUEST["is_admin"]=="true") { print <<
"Please enter your notes here on the request Listing"
EOD; } if($show_upgrade and $_REQUEST["is_admin"]!="true"){ print <<
To subscribe now for as low as $49.00/year, click on the subscribe button below
Payment Options
EOD; } //old popup for paypal //temporarily turn off $show_upgrade=false; if($show_upgrade){ $categories="None Selected"; if(isset($_POST["listing"]["new"]["categories"])) join(",",$_POST["listing"]["new"]["categories"]); $locations=array(); if(isset($_POST["listing"]["new"]["locations"])){ foreach($_POST["listing"]["new"]["locations"] as $locnum=>$info){ $items=array(); $items[]=get_country($info["country_id"]); $items[]=get_province($info["province_id"]); if(strlen($info["city"])) $items[]=$info["city"]; if(strlen($info["phone"])) $items[]="Phone: ".$info["phone"]; if(strlen($info["tollfree"])) $items[]="Toll Free: ".$info["tollfree"]; $locations[]=join(",",$items); } } if(count($locations)){ $location=join("
",$locations); } else $location="None Entered"; print <<
Upgrade to Premium Today

Your Free Listing Includes:

  • You company name
  • The "More Info" link that opens a new window with only your state/province, country and phone number
EOD; $_REQUEST["id"]=$_POST["listing"]["new"]["info"]["id"]; $test=true; include '../search/views/get_listings.php'; include '../search/views/get_listings_table.php'; print <<

Or...For less investment than the price of a cup of coffee per week, you can get the following:

  • Links to your company website
  • The "More Information" button that opens a new window with all of your contact and location information
  • A description of your company services right in the listing
  • A summary of your contact information right in the listing
  • Priority listing that displays at the top of search results
EOD; $_REQUEST["id"]=$_POST["listing"]["new"]["info"]["id"]; $test_premium=true; draw(); print <<
utton below
EOD; } if($show_premium){ print <<
Your Premium Listing Expires on {$_POST["listing"]["expires"]}
You will be rebilled through paypal for another year of premium listings on {$_POST["listing"]["expires"]}. If you would like to cancel your subscription renewal, click on the "Unsubscribe" button below.



Note: If you unsubscribe, your listing will remain a premium listing until {$_POST["listing"]["expires"]}
EOD; } // print "
";
//    print_r($_POST);
?>




EOD;

    foreach($list as $rownumber=>$row){
        if($rownumber==0) continue;
        
        if($row["id"]==$id) $selected="selected"; else $selected="";
        
        $options[]=<<{$row["name"]}
EOD;
    }
    return join("",$options);
}
function get_categories(&$list,&$current_categories,&$all_categories,&$selected_categories){

    $all_categories=array();
    $selected_categories=array();
    foreach($list as $rownumber=>$row){
        if($rownumber==0) continue;
        
        if(in_array($row["id"],$current_categories)){
            print <<
EOD;
            $selected_categories[]=<<{$row["name"]}
EOD;
        } else {
            $all_categories[]=<<{$row["name"]}
EOD;
        }
    }

    $all_categories=join("",$all_categories);
    $selected_categories=join("",$selected_categories);
}  

function get_country($id){
    global $_SESSION;
    
    $country="";
    if(isset($_SESSION["countries"])){
      foreach($_SESSION["countries"] as $rownumber=>$row){
          if($rownumber==0) continue;
          if($row["id"]==$id){
              $country=$row["name"];
              break;
          }
      }
    }
    return $country;
}
function get_province($id){
    global $_SESSION;

    $province="";
    if(isset($_SESSION["provinces"])){
      foreach($_SESSION["provinces"] as $rownumber=>$row){
          if($rownumber==0) continue;
          if($row["id"]==$id){
              $province=$row["name"];
              break;
          }
      }
    }
    return $province;
}

    $_SESSION["error"]="";




?>