:"|\\*]*$#', $base_path)) { $errors[] = "Base path must look like a valid URL path (e.g. / or /tkr/)."; } if ($items_per_page < 1 || $items_per_page > 50) { $errors[] = "Items per page must be a number between 1 and 50."; } // TODO: Actually handle errors if (empty($errors)) { $hash = password_hash($password, PASSWORD_DEFAULT); $stmt = $db->prepare("INSERT INTO user (username, display_name, password_hash) VALUES (?, ?, ?)"); $stmt->execute([$username, $display_name, $hash]); $stmt = $db->prepare("INSERT INTO settings (id, site_title, site_description, base_path, items_per_page) VALUES (1, ?, ?, ?, ?)"); $stmt->execute([$site_title, $site_description, $base_path, $items_per_page]); header("Location: index.php"); exit; } } ?>

Let’s Set Up Your tkr

UserModel settings






Site settings