* */ require_once('../../src/base.inc.php'); $error = ''; // Get the current user object. $user = new User(); if (isset($_GET['id']) and is_numeric($_GET['id'])) { $user = User::getById($_GET['id']); } // Save changes? if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Name if (isset($_POST['name']) and trim($_POST['name']) != '') { $user->setName($_POST['name']); } else { $error .= '
Name is a required field.
'; } // Email if (isset($_POST['email']) and trim($_POST['email']) != '') { $user->setEmail($_POST['email']); } else { $error .= 'Email is a required field.
'; } // Source if (isset($_POST['source']) and trim($_POST['source']) != '') { $user->setSource($_POST['source']); } else { $error .= 'Source is a required field.
'; } // Set Admin $admin = isset($_POST['admin']) and $_POST['admin'] == '1'; $user->setAdmin($admin); // Set Notify $notify = isset($_POST['notify']) and $_POST['notify'] == '1'; $user->setNotify($notify); // Save the user if ($error == '') { if ($user->save()) { // Return to users list header("Location: index.php"); } else { $error .= 'An error has occured.
'; } } } require_once('../src/header.inc.php'); echo "