<?php
//-- Don't allow people to view this page directly
if(strstr($_SERVER['REQUEST_URI'], 'assignment_one_globals.php'))
 header("Location: assignment_one.php");

//-- Seconds before a second email can be sent
$time_limit = 20;
 
//-- Global Arrays
$input_array = array(
    "first_name" => "First Name",
    "last_name"  => "Last Name",
    "email"      => "Email",
    "street_one" => "Street Address",
    "street_two" => "Street Address",
    "city"       => "City",
    "province"   => "Province",
    "postal_one" => "Postal Code",
    "postal_two" => "Postal Code",
    "phone"      => "Phone Number",
    "message"    => "Comments"
);

$province_array = array(
    "AL"  => "Alberta",
    "BC"  => "British Columbia",
    "MA"  => "Manitoba",
    "NB"  => "New Brunswick",
    "NL"  => "Newfoundland and Labrador",
    "NWT" => "Northwest Territories",
    "NS"  => "Nova Scotia",
    "NU"  => "Nunavut",
    "ON"  => "Ontario",
    "PEI" => "Prince Edward Island",
    "QU"  => "Quebec",
    "SA"  => "Saskatchewan",
    "YU"  => "Yukon"
);


//-- Global Functions
function printReadable($array){
 echo "<pre>\n";
 print_r($array);
 echo "</pre>\n";
}

function isReferedCorrectly($refer, $check_send=true){
 if($check_send === true){
  if(!isset($_POST['check_send']) || $_POST['check_send'] != 'yes')
   doError("You were refered to this page incorrectly.");
 }
 
 if(!strstr($_SERVER['HTTP_REFERER'], $refer))
  doError("You were refered to this page incorrectly.");
}
?>