<?php
# This is a form to add companies to the database

# Our boilerplate include file
include ('standardinclude.inc');



# here we send our POST variables off to be processed
# Since register_globals is off, this is the perfect opportunity to validate out data.
#
# Here we're defining our variables for all user-supplied data
# and sending these defintions to getpostvars(),
# which will retrieve the POST variables and check for tainting, etc.
$company_name		= getpostvars('company_name', 90);
$address1		= getpostvars('address1', 40);
$address2		= getpostvars('address2', 40);
$city			= getpostvars('city', 30);
$state_id		= getpostvars('state_id', 2);
$zip			= getpostvars('zip', 5);
$contact_name		= getpostvars('contact_name', 30);
$contact_title		= getpostvars('contact_title', 30);
$contact_email		= getpostvars('contact_email', 30);
$url			= getpostvars('url', 50);
$phone_area		= getpostvars('phone_area', 3);
$phone_exchange		= getpostvars('phone_exchange', 3);
$phone_digits		= getpostvars('phone_digits', 4);
$phone_extension	= getpostvars('phone_extension', 4);
$fax_area		= getpostvars('fax_area', 3);
$fax_exchange		= getpostvars('fax_exchange', 3);
$fax_digits		= getpostvars('fax_digits', 4);
$fax_extension		= getpostvars('fax_extension', 4);
$validated		= getpostvars('validated', 5);
$password		= getpostvars('password', 16);
$verified		= getpostvars('verified', 16);


###############################################################################################
#                                       print header                                          #
###############################################################################################

$title	= 'Add Company';
include ("$settingspath/header.inc");





###############################################################################################
#                             print the form, or insert the data?                             #
###############################################################################################

if ( ( !($verified == 'true') ) ) {
  # we're still trying to input data, so let's print the form to the user
  include ('companyform.inc');
} else {
  # we're done with the form, so let's do the DB insert
  include ('companyquery.inc');
}


# print_r($_POST);


###############################################################################################
#                                      print footer                                           #
###############################################################################################

include("$settingspath/plainfooter.inc");

?>
