示例#1
0
文件: head.php 项目: bbogin/sr2s
//a temp permission for the "are you logged in" gate (in prepend)
require_once "prepend.php";
require_once "common.php";
require_once "db_" . $_SESSION['_SITE_CONF']['DBMANAGER'] . ".php";
if (isset($_POST["btnSubmit"])) {
    //logging out
    throw_the_bum_out("Goodbye!", "Logout: by id=" . $_SESSION["person_id"]);
    //let prepend take care of it (not really a bum)
}
$organization = "";
$person = "";
if (isset($_SESSION["person_id"])) {
    //logged in
    $db = new db_connect($_SESSION['_SITE_CONF']['DBEDITOR']);
    $sql = "SELECT name FROM " . $db->prefix . "a00_organization WHERE organization_id=:org";
    $stmt = $db->prepare($sql);
    $stmt->bindValue(':org', $_SESSION["organization_id"], PDO::PARAM_INT);
    $stmt->execute();
    if (!($row = $stmt->fetchObject())) {
        $organization = "--No Organization--";
    } else {
        $organization = COM_output_edit($row->name);
    }
    $stmt->closeCursor();
    $sql = "SELECT firstname, lastname FROM " . $db->prefix . "c00_person WHERE person_id=:person";
    $stmt = $db->prepare($sql);
    $stmt->bindValue(':person', $_SESSION["person_id"], PDO::PARAM_INT);
    $stmt->execute();
    $row = $stmt->fetchObject();
    $person = COM_output_edit($row->firstname . " " . $row->lastname);
    $stmt->closeCursor();