.logo a { color: #fff; text-decoration: none; font-size: 1.5rem; font-weight: bold; }
function sanitizeInput($data) { return htmlspecialchars(strip_tags(trim($data))); }
<?php require_once 'config/database.php'; require_once 'includes/functions.php'; requireLogin(); // Handle adding a new item if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_item'])) { $title = sanitizeInput($_POST['title']); $description = sanitizeInput($_POST['description']);
$stmt = $pdo->prepare("SELECT id, username, password_hash FROM users WHERE username = ? OR email = ?"); $stmt->execute([$username, $username]); $user = $stmt->fetch();
// Fetch user's items $stmt = $pdo->prepare("SELECT * FROM items WHERE user_id = ? ORDER BY created_at DESC"); $stmt->execute([$_SESSION['user_id']]); $items = $stmt->fetchAll(); ?> <?php include 'includes/header.php'; ?> <h2>Welcome, <?= htmlspecialchars($_SESSION['username']) ?>!</h2>
.logo a { color: #fff; text-decoration: none; font-size: 1.5rem; font-weight: bold; }
function sanitizeInput($data) { return htmlspecialchars(strip_tags(trim($data))); } php database website template
<?php require_once 'config/database.php'; require_once 'includes/functions.php'; requireLogin(); // Handle adding a new item if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_item'])) { $title = sanitizeInput($_POST['title']); $description = sanitizeInput($_POST['description']); .logo a { color: #fff
$stmt = $pdo->prepare("SELECT id, username, password_hash FROM users WHERE username = ? OR email = ?"); $stmt->execute([$username, $username]); $user = $stmt->fetch(); ?php require_once 'config/database.php'
// Fetch user's items $stmt = $pdo->prepare("SELECT * FROM items WHERE user_id = ? ORDER BY created_at DESC"); $stmt->execute([$_SESSION['user_id']]); $items = $stmt->fetchAll(); ?> <?php include 'includes/header.php'; ?> <h2>Welcome, <?= htmlspecialchars($_SESSION['username']) ?>!</h2>