function getFormPOST($option)
{
    //return an array containing a user and a demographic with the post data
    $d = new demographic();
    $u = new user();
    $d->getPOST();
    $u->getPOST();
    $post[0] = $u;
    $post[1] = $d;
    return $post;
}
include 'automate/user_functions.php';
include 'automate/header.php';
if (isset($_POST['submit'])) {
    //echo "<p>New form posted!</p>";
    $u = new user();
    $u->getPOST();
    if ($u->__get('login') == "ERROR" || $u->__get('pass') == 'ERROR' || $u->__get('fn') == "ERROR" || $u->__get('ln') == "ERROR" || $u->__get('created') == "ERROR") {
        echo "<h2 style='color : red; '> There were some errors with your submission. Please make sure you entered everything correctly.</h2>";
    } else {
        $u->__set('user_id', findEmptyKey('USER', 'user_id'));
        $u->__set('address_id', 0);
        $u->__set('lvl', 'COMM');
        $u2 = $u;
        $u->__set('password', sha1($u2->__get('pass')));
        $u2 = null;
        $d = new demographic();
        $d->getPOST();
        $d->__set('demographic_id', findEmptyKey('DEMOGRAPHIC', 'demographic_id'));
        $d->__set('user_id', $u->__get('user_id'));
        if ($u->validate() && $d->validate()) {
            $u->write('STANDARD');
            $d->write();
            @session_start();
            @($_SESSION['username'] = $u->__get('login'));
            @$_SESSION['loginstatus'] == 'IN';
            @($_SESSION['privilege'] = "COMM");
        } else {
            echo "<h2 style='color : red; '> There were some errors with your submission. Please make sure you entered everything correctly.</h2>";
        }
    }
}