title: News Posting Authorization System
body: <p>I am trying to make a news page for my site that would make sure that the user is owner rank in the database, It worked, but when I changed my rank, you could still see the message that is supposed to show if you are the correct rank. </p>
  
  <p><strong>Code for the news page</strong></p>
  
  <pre><code>&lt;?php
    require_once('appvars.php');
    require_once('connectvars.php');
  
    // Make sure the user is logged in before going any further.
    if (!isset($_SESSION['user_id'])) {
      echo '&lt;p class="login"&gt;Please &lt;a href="login.php"&gt;log in&lt;/a&gt; to access this page.&lt;/p&gt;';
      exit();
    }
    else {
      echo('&lt;p class="login"&gt;You are logged in as ' . $_SESSION['username'] . '. &lt;a href="logout.php"&gt;Log out&lt;/a&gt;.&lt;/p&gt;');
    }
  
    // Connect to the database
    $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
  
    // Grab the profile data from the database
    if (!isset($_GET['user_id'])) {
      $query = "SELECT rank FROM kaoscraft_user WHERE user_id = '" . $_SESSION['user_id'] . "'";
    }
    else {
      $query = "SELECT rank FROM kaoscraft_user WHERE user_id = '" . $_GET['user_id'] . "'";
    }
    $data = mysqli_query($dbc, $query);
  
  
    if (!$row['rank'] = 'Owner') {
    echo 'Youre not logged in';
    }
  
    else {
    echo 'Welcome';
    }
  
    mysqli_close($dbc);
  ?&gt;
  </code></pre>