Example #1
0
	<?php 
    #
    #Else process the login request
    #
} else {
    //Required classes
    require_once "classes/DBObject.php";
    require_once "classes/account.php";
    require_once "classes/protocol.php";
    require_once "classes/session.php";
    //initialize objects
    $account = new Account();
    $protocol = new Protocol();
    $session = new Session();
    $account->getFormValues($_POST);
    //validate login
    if ($account->Login()) {
        $account->Initialize();
        $id = $account->getAccountId();
        $protocol->Initialize($id);
        $proid = $protocol->getProtocolId();
        $userid = $account->getUserId();
        $accounttype = $account->getAccountType();
        $session->setUserId($userid);
        $session->setAccountType($accounttype);
        $query_string = 'id=' . urlencode($id) . '&proid=' . urlencode($proid);
        header("location:home/index.php?" . $query_string);
    } else {
        header("location:index.php?err=1");
    }
}