<?
session_start();
header("Cache-control: private");
require("quicklyweb.php");
require("security/secure.php");
adminify($_SESSION['sess_user'], $_SESSION['sess_admin']);
beginDocument("Company Information", $_SESSION['sess_user']);
$db = getDBConnection();
if ($_POST['updater'] == "CompanyInformation") {
$result = DBquery("UPDATE CompanyInformation SET CompanyName='$_POST[CompanyName]', Address1='$_POST[Address1]', Address2='$_POST[Address2]', Suburb='$_POST[Suburb]', State='$_POST[State]', Zip='$_POST[Zip]', Country='$_POST[Country]', Phone='$_POST[Phone]',Fax='$_POST[Fax]',Web='$_POST[Web]',Email='$_POST[Email]',CompanyNumber='$_POST[CompanyNumber]' ", $db);
checkDBerror($db);
if(!(is_integer($result)) or ($result == 1)) {
beginPrettyTable("1", "Company Information");
echo "<tr>\n";
echo " <td>\n";
echo " <div class=data>Company information updated successfully <a href='settings.php'>$lAdminPage</a></div>\n";
echo " </td>\n";
echo "</tr>\n";
endPrettyTable();
} else {
beginPrettyTable("1", "Company Information Update");
echo "<tr> <td><div class=data>Company information update failed: ";
echo mysql_error();
echo "</div></td></tr>\n";
endPrettyTable();
}
} else {
$result = DBquery("SELECT * FROM CompanyInformation", $db);
$company_row = DBfetch_array($result);
openForm("CompanyInformation", $_SERVER['PHP_SELF']);
makeHiddenField("updater", "CompanyInformation");
beginPrettyTable("2", "Company Information");
beginBorderedTable("2");
makeTextField("Company Name", "CompanyName", $company_row["CompanyName"]);
makeTextField("Address1", "Address1", $company_row["Address1"]);
makeTextField("Address2", "Address2", $company_row["Address2"]);
makeTextField("Suburb", "Suburb", $company_row["Suburb"]);
makeTextField("State", "State", $company_row["State"]);
makeTextField("Zip", "Zip", $company_row["Zip"]);
makeTextField("Country", "Country", $company_row["Country"]);
makeTextField("Phone", "Phone", $company_row["Phone"]);
makeTextField("Fax", "Fax", $company_row["Fax"]);
makeTextField("Web", "Web", $company_row["Web"]);
makeTextField("Email", "Email", $company_row["Email"]);
makeTextField("Company Number", "CompanyNumber", $company_row["CompanyNumber"]);
makeSubmitter();
endBorderedTable();
endPrettyTable();
closeForm();
}
endDocument();
?>