Example #1
0
}
if ($_POST['commit'] == "Save User") {
    if ($id == 0) {
        // add the listing
        $objSystemUser = new SystemUser();
        $objSystemUser->FirstName = $_REQUEST['first_name'];
        $objSystemUser->LastName = $_REQUEST['last_name'];
        $objSystemUser->EmailAddress = $_REQUEST['email_address'];
        $objSystemUser->Password = $_REQUEST['password'];
        $is_admin = 0;
        if (isset($_REQUEST['is_admin'])) {
            $is_admin = 1;
        }
        $objSystemUser->IsAdmin = $is_admin;
        $objSystemUser->DateAdded = date('Y-d-m H:i:s');
        $objSystemUser->create();
        // redirect to listing list
        header("Location:user_list.php");
        exit;
    } else {
        $objSystemUser = new SystemUser($_REQUEST["id"]);
        $objSystemUser->FirstName = $_REQUEST['first_name'];
        $objSystemUser->LastName = $_REQUEST['last_name'];
        $objSystemUser->EmailAddress = $_REQUEST['email_address'];
        if (isset($_REQUEST['password'])) {
            $objSystemUser->Password = $_REQUEST['password'];
        }
        $is_admin = 0;
        if (isset($_REQUEST['is_admin'])) {
            $is_admin = 1;
        }