title: Redirect depending of the UserID
body: <p>so i have this login page  </p>
  
  <pre><code>&lt;?php
      require("common.php"); 
      $submitted_username = '';
      if(!empty($_POST))
      {
          $query = "
              SELECT
                  id,
                  username,
                  password,
                  salt,
                  email
              FROM users
              WHERE
                  username = :username
          ";
          $query_params = array(
              ':username' =&gt; $_POST['username']
          );
  
          try
          {
              $stmt = $db-&gt;prepare($query);
              $result = $stmt-&gt;execute($query_params);
          }
          catch(PDOException $ex)
          {
              die("Failed to run query: " . $ex-&gt;getMessage());
          }
          $login_ok = false;
          $row = $stmt-&gt;fetch();
          if($row)
          {
              $check_password = hash('sha256', $_POST['password'] . $row['salt']);
              for($round = 0; $round &lt; 65536; $round++)
              {
                  $check_password = hash('sha256', $check_password . $row['salt']);
              }
  
              if($check_password === $row['password'])
              {
                  $login_ok = true;
              }
          }
          if($login_ok)
          {
              unset($row['salt']);
              unset($row['password']);
              $_SESSION['user'] = $row;
              header("Location: private.php");
              die("Redirecting to: private.php");
          }
          else
          {
              print("Login Failed.");
              $submitted_username = htmlentities($_POST['username'], ENT_QUOTES, 'UTF-8');
          }
      }
  
  ?&gt;
  &lt;h1&gt;Login&lt;/h1&gt;
  &lt;form action="login.php" method="post"&gt;
      Username:&lt;br /&gt;
      &lt;input type="text" name="username" value="&lt;?php echo $submitted_username; ?&gt;" /&gt;
      &lt;br /&gt;&lt;br /&gt;
      Password:&lt;br /&gt;
      &lt;input type="password" name="password" value="" /&gt;
      &lt;br /&gt;&lt;br /&gt;
      &lt;input type="submit" value="Login" /&gt;
  &lt;/form&gt;  
  </code></pre>
  
  <p>Session(common.php)  </p>
  
  <pre><code>&lt;?php
  
      // These variables define the connection information for your MySQL database
      $username = "root";
      $password = "";
      $host = "localhost";
      $dbname = "phplogin";
  
  
      $options = array(PDO::MYSQL_ATTR_INIT_COMMAND =&gt; 'SET NAMES utf8');
      try
      {
          $db = new PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password, $options);
      }
      catch(PDOException $ex)
      {
          die("Failed to connect to the database: " . $ex-&gt;getMessage());
      }
      $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      $db-&gt;setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
  
      if(function_exists('get_magic_quotes_gpc') &amp;&amp; get_magic_quotes_gpc())
      {
          function undo_magic_quotes_gpc(&amp;$array)
          {
              foreach($array as &amp;$value)
              {
                  if(is_array($value))
                  {
                      undo_magic_quotes_gpc($value);
                  }
                  else
                  {
                      $value = stripslashes($value);
                  }
              }
          }
  
          undo_magic_quotes_gpc($_POST);
          undo_magic_quotes_gpc($_GET);
          undo_magic_quotes_gpc($_COOKIE);
      }
  
      header('Content-Type: text/html; charset=utf-8');
      session_start();
  ?&gt;  
  </code></pre>
  
  <p>what i wanted to do is when the user who login has the "id" of "5" it will be redirected to another page different from the stated in the code which is private.php. could i redirect it to another page if it finds out that the "id" is equal to five. it like sort of admin page.</p>