include "/var/www/vhosts/kootenays-rockies.com/httpdocs/lib/phpdir.php";
require("$webdir/include/config.php");
require("$webdir/include/database.php");
require("$webdir/include/get-website.php");
// 0 --> posts to secure server, 1 --> prints posts sent to secure server
$testPosts = 0;
// sets styling / prevents display of homepage textlink (only all)
$cat = "submitbusiness";
// get the website num
$SiteNum = db_getVal("SELECT record_num FROM portal_websites WHERE website='$CurrentWebsite' LIMIT 1");
include "$webdir/includes/internal-header.html";
// set up banners
$bannerKeyword = "Home";
$WebSite = $CurrentWebsite; // set website ID (needed for banners)
include "$webdir/include/display-banners.php"; // bannerCode set here
$number_of_side_banners = 3;
if (isset($_POST['stage'])) $stage = $_POST['stage'];
if (!$stage) {
include "agreement.html";
include "$webdir/includes/internal-footer.html";
exit;
}
if ($stage == "one") {
include "submission_form.html";
$number_of_side_banners = 4;
include "$webdir/includes/internal-footer.html";
exit;
}
$error_message = null;
extract($_POST);
// Verify all required fields are filled in
if (!$contact_name) $error_message .= "Contact Name is required
\n";
if (!$contact_phone) $error_message .= "Contact Phone Number is required
\n";
if (!$contact_email) $error_message .= "Contact Email is required
\n";
elseif (!eregi("[a-z0-9_\.\-]*@[a-z0-9\.\-]*\.[a-z]{2,3}",$contact_email)) $error_message .= "Invalid Contact Email
\n";
if (!$business_name) $error_message .= "Business Name is required
\n";
if (!$address) $error_message .= "Address is required
\n";
if (!$city) $error_message .= "City is required
\n";
if (!$province) $error_message .= "Province is required
\n";
if (!$country) $error_message .= "Country is required
\n";
// if country is canada or us, prov & postal must be specified, otherwise optional
switch ($country) {
case 'CA':
$postal = ereg_replace(' ', '', $postal);
if ($province == '') $error_message .= "Invalid Canadian province
\n";
if ((!eregi('^[A-Z][0-9][A-Z] ?[0-9][A-Z][0-9]$', $postal)) || $postal == '') {
$error_message .= "Invalid Canadian postal code
\n";
}
break;
case 'US':
$postal = trim($postal);
if ($province == '') $error_message .= "Invalid US state
\n";
if ((!eregi('^[0-9]{5}(-[0-9]{4})?$', $postal)) || $postal == '') {
$error_message .= "Invalid US zip code
\n";
}
break;
}
if (!$phone) $error_message .= "Phone is required
\n";
if (!$email) $error_message .= "Email Address is required (Business Profile)
\n";
elseif (!eregi("[a-z0-9_\.\-]*@[a-z0-9\.\-]*\.[a-z]{2,3}",$email)) $error_message .= "Invalid Email Address (Business Profile)
\n";
// check description text
if (!$description) $error_message .= "Description is required
\n";
// Cleanup spaces and HTML characters
$description = ereg_replace("\r","",$description);
$description = ereg_replace("\n"," ",$description);
$description = ereg_replace(" "," ",$description);
$description = ereg_replace(" "," ",$description);
$description = ereg_replace(" "," ",$description);
$description = ereg_replace("^ ","",$description);
$description = ereg_replace("’","'",$description);
$description = ereg_replace("‘","'",$description);
$description = ereg_replace("–","-",$description);
$description = ereg_replace("“",'"',$description);
$description = ereg_replace("”",'"',$description);
$description = ereg_replace(" $","",$description);
$description = strip_tags($description);
// check description length
if (strlen($description) > $max_description) {
$error_message .= "Description is too long (". strlen($description) . " chars) -- max: $max_description chars
\n";
$error_message .= "Current length is " . strlen($description) . "
\n";
}
// check listing info
if (count($regSel) < 1) $error_message .= "You must select at least one Region
\n";
if (count($subSel) < 1) $error_message .= "You must select at least one Category
\n";
// If there is an error display the edit form again
if ($error_message) {
include "submission_form.html";
include "$webdir/includes/internal-footer.html";
exit;
}
// Check for a default href value
if ($href == "http://") $href = null;
// Verify details of business listing
if ($stage == "two") {
// sets form action based on mode
// $formAction = "https://secure.in-vancouver.com/secure/$CurrentWebsite/";
// $formAction = "https://secure.in-vancouver.com/secure/demo55.abcguide.com/";
if ($testPosts) $formAction = "/submitbusiness/";
$formAction = "/submitbusiness/";
include "confirm_listing.php";
$number_of_side_banners = 4;
include "$webdir/includes/internal-footer.html";
exit;
}
// for testing vars going to payment form (change form action from previous form)
if ($stage == "cc_info") {
echo"
"; print_r($GLOBALS); echo"