<?php require 'config.php'; protected_area(true); $crud->table = "user"; // List out existings users $user_list = $crud->select('*'); // Track any errors $errors = []; if (isset($_GET['create'])) { // POST the form $login = $_POST['login']; $password = $_POST['password']; $password_confirm = $_POST['password_confirm']; $email = $_POST['email']; // Error checking if (strlen($login) == 0) { $errors[] = "Login is required!"; } if (strlen($password) == 0) { $errors[] = "Password is required!"; } if ($password != $password_confirm) { $errors[] = "Passwords do not match!"; } if (strlen($email) == 0) { $errors[] = "Email is required!"; } // Success if (empty($errors)) { $user_id = $crud->insert(['login' => $login, 'password' => hash256($password), 'email' => $email]);
<?php require 'config.php'; protected_area(); ?> <?php include 'header.php'; ?> <hr /> <div class="container"> <h1>Dashboard</h1> <a class="btn btn-md btn-danger" href="index.php?logout">Logout</a> <a class="btn btn-md btn-success" href="user.php">Create User</a> </div> <?php include 'footer.php';