Hide a from non-members

I’m writing a PHP script which allows my users to create their own pages and get a URL hosted on my hosting service. After the user creates their page, they get a link to a page which includes a navbar (containing Navbar) and the page itself. Now, they can share this page anywhere they want by copying the link my script gave them.

The problem is, everyone else also sees the navbar which is intended only for the creator of that page (such as edit page, etc.).

Here is how my script checks if the user is logged in (I can’t change this)

if (!isset($_SESSION['userid']) || empty($_SESSION['userid'])) {
// If not logged in, redirect to the login page
header("Location: login.php");
exit();
}

Here is how the script gets the User ID:

$userid = $_SESSION["userid"];
$getuserdata = mysql_query("Select email, mtype, joindate from ".$prefix."members where Id=$userid");
$useremail = mysql_result($getuserdata, 0, "email");
$mtype = mysql_result($getuserdata, 0, "mtype");

and this is the code I am using show the only if $mtype is 0:

// Determine if the current user is the creator of the page
$isCreator = ($userid == $page['user_id']);

// Add the header only if the current user is the creator
if ($isCreator) {
$pageContent .= "
<header class='bg-light p-3 " . ($mtype == 0 ? "hidden-header" : "") . "'>
<div class='container'>
<a href='/members.php' class='btn btn-primary'>Dashboard</a>
<a href='/instagram_embed_start.php' class='btn btn-secondary'>Edit Page</a>
<a href='/signup.php?rid=<?php echo $userid; ?>' class='btn btn-success'>Create Yours</a>
</div>
</header>";
}

// Add CSS to hide the header if the user is not a member
$pageContent .= "
<style>
.hidden-header {
display: none !important;
}
</style>";

In reality, I want all users except for the creator of the page to NOT see this part. Obviously, this is because they won’t have the ability to edit the page in the first place. Any insights will be highly appreciated.