示例#1
0
if (isset($_GET['addform'])) {
    $data['login'] = $_POST['username'];
    $data['password'] = $_POST['password'];
    $data['email'] = $_POST['email'];
    $data['name'] = $_POST['name'];
    $successFlag = $validateUser->add_user($data);
    if (!$successFlag) {
        $error = 'Error adding user.';
        include CMS_ERROR;
        exit;
    }
    header('Location: .');
    exit;
}
if (isset($_POST['action']) and $_POST['action'] == 'Edit') {
    $userDetails = $validateUser->get_user($_POST['id']);
    if (!$userDetails) {
        $error = 'Error fetching users .';
        include CMS_ERROR;
        exit;
    }
    foreach ($userDetails as $row) {
        $name = $row['name'];
        $email = $row['email'];
        $login = $row['login'];
        $id = $row['id'];
    }
    $pageTitle = 'Edit user';
    $action = 'editform';
    $password = '';
    $button = 'Update user';