register($username, $password) ) { $_SESSION['notice'] = "Registration successful.
You can log in now."; header('Location: index.php'); exit(); // registration fail, redirect to login } else { $_SESSION['error'] = "Registration failed."; header('Location: index.php'); exit(); } } } catch (Exception $e) { $error = $e->getMessage(); } include 'templates/block-message.php'; include 'templates/form-register.php'; ?>