Add User

All fields are required! Password must be 8+ characters. Username and email must be unique.

prepare($query); $stmt->execute(array( ':username' => $_POST['username'], ':email' => $email )); $existing = $stmt->fetchObject(); if ($existing) { if ($existing->username == $_POST['username']) { $errors['username'] = "That username is already in use."; } if ($existing->email == $email) { $errors['email'] = "That email address is already in use."; } } } if (!empty($_POST['newuser']) && empty($errors)) { $hasher = new PasswordHash(8, FALSE); $password = $hasher->HashPassword($_POST['password']); $query = "INSERT INTO users (firstname, lastname, username, password, email, created, usertype) VALUES (:firstname, :lastname, :username, :password, :email, NOW(), :usertype)"; $stmt = $yaptc_db->prepare($query); $success = $stmt->execute(array( ':firstname' => $_POST['firstname'], ':lastname' => $_POST['lastname'], ':username' => $_POST['username'], ':password' => $password, ':email' => $_POST['email'], ':usertype' => $_POST['usertype'], )); if ($success) { $message = "Account created."; } else { echo "Account could not be created. Please try again later."; } } ?>

prepare("DELETE FROM users WHERE users.id=$deleteid"); $deletequery->execute(); echo "user deleted!"; if ($deletequery !== false) { header("Location: {$_SERVER['PHP_SELF']}", true, 303); exit; } } } ?>

User List

Current users. To edit, select the edit button in the right column.

" . $row['firstname'] . ""; echo ""; echo ""; echo ""; echo ""; echo ""; ?>
First Name Last Name Username Email Created User Type Actions
" . $row['lastname'] . "" . $row['username'] . "" . $row['email'] . "" . $row['created'] . "" . $row['usertype'] . "