<?php
// include function files for this application
require_once("referrals_fns.php");
session_start();
header("Cache-control: private");
// Make sure the user is logged in as admin
if (check_admin_user())
{
// Verify that all of the required fields are filled out before
// updating the organization
if (org_required_fields($HTTP_POST_VARS))
{
$orgid = $HTTP_POST_VARS["Org_ID"];
// Check to make sure organization exists before updating
// (prevents users who hit reload from recieving a php error)
$orgexists = organization_exists($orgid);
if ($orgexists == 2)
{
do_html_header("Updating organization");
echo "Failure updating organization, it does not exist.<P>";
}
else
{
// All is well, update the organization
$b = new Organization();
$b->setpostvars($HTTP_POST_VARS);
$updatestatus = $b->updateorg();
if ($updatestatus == 1)
{
// Redirect user to the show the udpated organization
header("Location: http://".$_SERVER['HTTP_HOST']
.dirname($_SERVER['PHP_SELF'])
."/".
"show_organization.php?orgid=$orgid");
}
}
}
else
{
do_html_header("Updating organization");
print_required_fields();
}
}
else
{
echo "You are not authorized to view this page.";
}
do_html_footer();
?>