echo '</header>';

	echo '<h3 class="SponsID">';
	echo 'SponsID: ' . $SponsID;
	echo '<br>Name: ' . get_person_name($SponsID);

	$role = get_access_level($SponsID);
	$printing_role = $role;
	if ($role == 'SponsRep') $printing_role = "Sponsorship Representative";
	if ($role == 'SectorHead') $printing_role = "Sector Head";
	if ($role == 'CSO') $printing_role = "Chief Sponsorship Officer";
	echo '<br>Role: ' . $printing_role;

	if (get_access_level($SponsID) == "SponsRep" || get_access_level($SponsID) == "SectorHead"){
		echo '<br>Sector: ' . get_person_sector($SponsID);
	}
	echo '</h3>';


	echo '<div align="center">';


	$meeting_view_query = "SELECT
		SponsOfficer.SponsID as 'SponsID',
		Name as 'SponsRep Name',
		CMPName as 'Company Name',
		CEName as 'Company Executive Name',
		MeetingType as 'Meeting Type',
		Date,
<?php

session_start();
require './DBconnect.php';
require './library_functions.php';
$SponsID = $_SESSION['loginID'];
//get SponsID from previos session
$SponsAccessLevel = get_access_level($SponsID);
if ($SponsAccessLevel != "CSO") {
    header('Location: ./home.php');
}
// //Amount Earned By Each Sector Pie Chart
// $Amount_Earned_by_IT_Sector =  mysql_query("SELECT sum(Amount) Amount_Earned_by_Sector_in_Rupees FROM
//                               (`AccountLog` inner join ((SELECT SponsID, Sector FROM `SectorHead`)
//                                 UNION (SELECT SponsID, Sector FROM SponsRep)) as `SponsOfficer` on SponsOfficer.SponsID = AccountLog.SponsID)
//                                 WHERE Sector=\"IT\" GROUP BY `Sector` ORDER BY Amount_Earned_by_Sector_in_Rupees DESC;");
// $Amount_Earned_by_IT_Sector_Result = mysql_fetch_assoc($Amount_Earned_by_IT_Sector);
// $IT = (int)$Amount_Earned_by_IT_Sector_Result["Amount_Earned_by_Sector_in_Rupees"];
// $Amount_Earned_by_Builders_Sector =  mysql_query("SELECT sum(Amount) Amount_Earned_by_Sector_in_Rupees FROM
//                           (`AccountLog` inner join ((SELECT SponsID, Sector FROM `SectorHead`)
//                             UNION (SELECT SponsID, Sector FROM SponsRep)) as `SponsOfficer` on SponsOfficer.SponsID = AccountLog.SponsID)
//                             WHERE Sector=\"Builders\"
//                           GROUP BY `Sector` ORDER BY Amount_Earned_by_Sector_in_Rupees DESC;");
// $Amount_Earned_by_Builders_Sector_Result = mysql_fetch_assoc($Amount_Earned_by_Builders_Sector);
// $Builders = (int)$Amount_Earned_by_Builders_Sector_Result["Amount_Earned_by_Sector_in_Rupees"];
// $Amount_Earned_by_Clothes_Retail_Sector =  mysql_query("SELECT sum(Amount) Amount_Earned_by_Sector_in_Rupees FROM
//                               (`AccountLog` inner join ((SELECT SponsID, Sector FROM `SectorHead`)
//                                 UNION (SELECT SponsID, Sector FROM SponsRep)) as `SponsOfficer` on SponsOfficer.SponsID = AccountLog.SponsID)
//                                 WHERE Sector=\"Clothes Retail\"
//                               GROUP BY `Sector` ORDER BY Amount_Earned_by_Sector_in_Rupees DESC;");
// $Amount_Earned_by_Clothes_Retail_Sector_Result = mysql_fetch_assoc($Amount_Earned_by_Clothes_Retail_Sector);
        foreach ($auth_info as $user_id => $info) {
            if ($user_id != $_SESSION['user_id']) {
                echo "<option value=\"" . $info['id'] . "\">" . $info['username'] . "</option>\n";
            }
            //Don't let admins modify their own privileges
        }
        echo "</select></td>\n" . "<td rowspan=\"2\" style=\"width:175px\">";
        echo_checkboxes();
        echo "</td>\n" . "<td><input type=\"submit\" value=\"Modify User\"></td></tr>\n" . "<tr><td style=\"vertical-align:top\"><b>Full Name:</b><br><input type=\"text\" name=\"real_name\" style=\"width:150px\"></td><td></td></tr>" . "</table>\n</form>";
        break;
        //----------------------------------------
    //----------------------------------------
    case 'add_user':
    default:
        if (isset($_POST['username'])) {
            $access_level = get_access_level();
            $result = add_user($_POST['username'], $_POST['password'], $_POST['real_name'], $access_level);
            if ($result != 1) {
                echo "<br>" . $result . "<br>\n";
            } else {
                echo "<br>User has been successfully added!<br>\n";
            }
        }
        echo "<br><br><form action=\"" . $_SERVER['PHP_SELF'] . "?function=add_user\" method=\"POST\">\n" . "<table id=\"checkbox_table\">\n" . "<tr><th colspan=\"4\">Add User Account</th></tr>\n" . "<tr><th>Username</th><th>Password</th><th style=\"width:150px\">Access</th><th>&nbsp;</th></tr>\n" . "<tr><td style=\"vertical-align:top\"><input type=\"text\" name=\"username\" style=\"width:100px\"></td>\n" . "<td><input type=\"password\" name=\"password\" style=\"width:100px\"></td>\n" . "<td rowspan=\"2\">";
        echo_checkboxes();
        echo "</td>\n" . "<td><input type=\"submit\" value=\"Add User\"></td></tr>\n" . "<tr><td colspan=\"2\" style=\"vertical-align:top\"><b>Full Name:</b><br><input type=\"text\" name=\"real_name\" style=\"width:150px\"></td><td></td></tr>" . "</table>\n</form>";
        break;
}
//END switch
?>
    </div><!-- END 'content' -->