/**
  * Process New Account
  *
  * Prepare an AccountDBO, then prompt the client to confirm the new account
  */
 function process_new_account()
 {
     // Make sure the username is available
     try {
         load_UserDBO($this->post['username']);
         throw new SWUserException("[DB_USER_EXISTS]");
     } catch (DBNoRowsFoundException $e) {
     }
     // Prepare AccountDBO
     $account_dbo = new AccountDBO();
     $account_dbo->load($this->post);
     $user_dbo = new UserDBO();
     $user_dbo->setUsername($this->post['username']);
     $user_dbo->setPassword($this->post['password']);
     $user_dbo->setEmail($this->post['contactemail']);
     $user_dbo->setContactName($this->post['contactname']);
     $user_dbo->setType("Client");
     // Place DBO in the session for confirm page
     $this->session['new_account_dbo'] = $account_dbo;
     $this->session['user_dbo'] = $user_dbo;
     // Ask client to confirm
     $this->setTemplate("confirm");
 }
/**
 * Load multiple Account DBO's from database
 *
 * @param string $filter A WHERE clause
 * @param string $sortby Field name to sort results by
 * @param string $sortdir Direction to sort in (ASEC or DESC)
 * @param integer $limit Limit the number of results
 * @param integer $start Record number to start the results at
 * @return array Array of AccountDBO's
 */
function &load_array_AccountDBO($filter = null, $sortby = null, $sortdir = null, $limit = null, $start = null)
{
    $DB = DBConnection::getDBConnection();
    // Build query
    $sql = $DB->build_select_sql("account", "*", $filter, $sortby, $sortdir, $limit, $start);
    // Run query
    if (!($result = @mysql_query($sql, $DB->handle()))) {
        // Query error
        throw new DBException(mysql_error($DB->handle()));
    }
    if (mysql_num_rows($result) == 0) {
        // No rows found
        throw new DBNoRowsFoundException();
    }
    // Build an array of DBOs from the result set
    $dbo_array = array();
    while ($data = mysql_fetch_array($result)) {
        // Create and initialize a new DBO with the data from the DB
        $dbo = new AccountDBO();
        $dbo->load($data);
        // Add DomainServiceDBO to array
        $dbo_array[] = $dbo;
    }
    return $dbo_array;
}