Exemplo n.º 1
0
<?php

include_once 'common/base.php';
/*
 *check if the form is submitted, and verify and register
 *if not then print the form
 */
$title = "signUp";
include_once 'common/header.php';
include_once './forms/form.signup.php';
$form = new SignupForm($db);
if ($form->read()) {
    //echo "The form is submitted.";
    if ($form->isValid()) {
        //echo "<br/>The form is valid";
        $fields = $form->getArray();
        include_once './models/class.users.php';
        $user = new UserClass($db);
        if ($user->insert($fields)) {
            echo "<div id='note'>\n\t\t \t\t\t\t\t\t\t\t<p>Congratulation. You are registered.</p>\n\t\t \t\t\t\t\t\t\t\t<p><a href='./login.php'>Login</a></p>\n\t\t \t\t\t\t\t\t\t</div>";
        }
    } else {
        //echo "<br/>form is invalid.";
        $form->display();
    }
} else {
    //echo "The signup is not posted.";
    $form->display();
}
$footer = "copyright &copy; 2012 reserved to rajan prasad upadhyay.";
include_once './common/footer.php';