I need advice. I have system with login panel. And I need create profile site but I need to show only profile site of one logged user. So I need to store that username from variable into something I can store for longer time. My login panel looks like this:
<?php
} else {
    if(isset($_POST['username'], $_POST['password'])){
        $username= $_POST['username'];
        $password= md5($_POST['password']); 
        $rola = "ziak";
        if (empty($username) or empty($password)) {
            $error= "Všetky políčka je potrebné vyplniť!";
        } else {
            $query = $pdo->prepare("SELECT * FROM ziaci WHERE ziak_meno = ? AND ziak_heslo = ? AND rola = ?");
            $query->bindValue(1, $username);
            $query->bindValue(2, $password);
            $query->bindValue(3, $rola);
            $query->execute();
            $num = $query->rowCount();
            if ($num == 1) {
                $_SESSION['logged_in'] = true;
                header("Location: index.php");
                exit();
            } else {
                $error = "Nesprávne meno/heslo alebo nemáte status administrátora";
            }
        }
    }
    ?>
of course I have defined connection and other things. (this system is functional I only need to "save" that variable
 
     
    