Display logged in user information

I have got a basic registration and login forms and when the user registers then their information is sent to the database and when the user uses the same username and password then they can login into the site. Upon logging in, the user is directed to the account pages at where I am trying to get the logged in users information, like first name and surname.

account.PHP

<?php
  require("classes/functions.php");
  if (!isset($_SESSION["user"])) {
    header("location: login.php");
    exit();
  }

?>
<div class="container">
              <div class="row justify-content-center">
                  <div class="col-md-7 col-lg-4 mb-5 mb-lg-0 wow fadeIn">
                      <div class="card border-0 shadow">
                          <img src="" alt="...">
                          <div class="card-body p-1-9 p-xl-5">
                              <div class="mb-4">
                                  <h3 class="h4 mb-0"><?php echo $_SESSION["user"];?></h3>
                                  <span class="text-primary">CEO & Founder</span>
                              </div>
                              <ul class="list-unstyled mb-4">
                                  <li class="mb-3"><a href="#!"><i class="far fa-envelope display-25 me-3 text-secondary"></i>[email protected]</a></li>
                                  <li class="mb-3"><a href="#!"><i class="fas fa-mobile-alt display-25 me-3 text-secondary"></i>+012 (345) 6789</a></li>
                                  <li><a href="#!"><i class="fas fa-map-marker-alt display-25 me-3 text-secondary"></i>205 Main Street, USA</a></li>
                              </ul>
                              <ul class="social-icon-style2 ps-0">
                                  <li><a href="#!" class="rounded-3"><i class="fab fa-facebook-f"></i></a></li>
                                  <li><a href="#!" class="rounded-3"><i class="fab fa-twitter"></i></a></li>
                                  <li><a href="#!" class="rounded-3"><i class="fab fa-youtube"></i></a></li>
                                  <li><a href="#!" class="rounded-3"><i class="fab fa-linkedin-in"></i></a></li>
                              </ul>
                          </div>
                          <a class="btn btn-primary" href="#" role="button">Edit Profile</a>
                      </div>
                  </div>

register

function registerUser($fname, $surname, $email, $password, $confirm_password, $username){
        $mysqli = connect();
        $args = func_get_args();

        $args = array_map(function($value){
            return trim($value);
        }, $args);

        foreach ($args as $value) {
            if (empty($value)) {
                return "All fields are required";
            }
        }

        foreach ($args as $value) {
            if (preg_match("/([<|>])/", $value)) {
                return "<> characters are not allowed";
            }
        }

        $stmt = $mysqli->prepare("SELECT email FROM users WHERE email = ?");
        $stmt->bind_param("s", $email);
        $stmt->execute();
        $result = $stmt->get_result();
        $data = $result->fetch_assoc();
        if ($data != NULL) {
            return "Email already exists";
        }

        if (strlen($username) > 50) {
            return "Username is to long";
        }

        $stmt = $mysqli->prepare("SELECT username FROM users WHERE username = ?");
        $stmt->bind_param("s", $username);
        $stmt->execute();
        $result = $stmt->get_result();
        $data = $result->fetch_assoc();
        if ($data != NULL) {
            return "Username already exists, please use a different username";
        }

        if (strlen($fname) > 50) {
            return "First name is to long";
        }

        if (strlen($surname) > 50) {
            return "Surname is to long";
        }

        if (strlen($password) > 50) {
            return "Password is to long";
        }

        if ($password != $confirm_password) {
            return "Password don't match";
        }

        $hashed_password = password_hash($password, PASSWORD_DEFAULT);

        $stmt = $mysqli->prepare("INSERT INTO users(fname, surname, email, password, username) VALUES(?, ?, ?, ?, ?)");
        $stmt->bind_param("sssss", $fname, $surname, $email, $hashed_password, $username);
        $stmt->execute();
        if ($stmt->affected_rows != 1) {
            return "An error occurred. Please try again";
        }else{
            return "success";
        }
    }

Login

function loginUser($username, $password){
        $mysqli = connect();
        $username = trim($username);
        $password = trim($password);

        if ($username == "" || $password == "") {
            return "Both fields are required";
        }

        $username = filter_var($username, FILTER_SANITIZE_STRING);
        $password = filter_var($password, FILTER_SANITIZE_STRING);

        $sql = "SELECT username, password FROM users WHERE username = ?";
        $stmt = $mysqli->prepare($sql);
        $stmt->bind_param("s", $username);
        $stmt->execute();
        $result = $stmt->get_result();
        $data = $result->fetch_assoc();
        if ($data == NULL) {
            return "Wrong username or password";
        }

        if (password_verify($password, $data["password"]) == FALSE) {
            return "Wrong username or password";
        }else{
            $_SESSION['user'] = $username;
            header("location: account.php");
            exit();
        }
    }

I have attempted many methods, including google searches and searching on here, but nothing seams to work. I am expecting to display the logged in users first name, surname, email address ect

Thanks in advance.

New contributor

KyleL199 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật