title: Create a simple PHP login with sessions and multiple users
body: <p>I am searching for a answer how to create a $_SESSION login. </p>
  
  <p>The result I get every time is Dexter. Even when I just press the login button. I am using sessions and no MySQL or other database. I am just in the beginning to learn PHP and have looked around here and used google but I can't relate was I am doing wrong. </p>
  
  <p>The login page looks like this: </p>
  
  <pre><code>        &lt;?php 
          session_start();
          $_SESSION['usernamne1'] = "Dexter"; 
          $_SESSION['usernamne2'] = "River";
          $_SESSION['usernamne3'] = "Miro";
  
          $_SESSION['password1'] = "meow1";
          $_SESSION['password2'] = "meow2";
          $_SESSION['password3'] = "meow3";
          ?&gt;
  &lt;?php //Header  include fil
  $page_title = 'Login'; //Dynamic titel 
  include('includes/header.html');
  ?&gt; 
  &lt;?php 
  echo "&lt;h3&gt;Login!&lt;/h3&gt;";
  echo "&lt;br /&gt;";
  ?&gt;
  
  &lt;form method="post" Action="sida7logged.php"&gt;
  
  &lt;fieldset&gt;&lt;legend&gt;Fyll i dina användaruppgifter&lt;/legend&gt;
  
  &lt;p&gt;&lt;label&gt;Username: &lt;br /&gt;
  &lt;input name="usernamne" type="text"&gt;&lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;label&gt;Password: &lt;br /&gt;
  &lt;input name="password" type="password"&gt;&lt;/label&gt;&lt;/p&gt;
  
  &lt;input type="Submit" value="Login"&gt;
      &lt;/fieldset&gt;
      &lt;/form&gt; 
  
  
  &lt;?php //Footer include file 
  include('includes/footer.html');
  ?&gt;
  </code></pre>
  
  <p>And when logged in:</p>
  
  <pre><code>    &lt;?php 
  $page_title = 'Logged in'; //Dynamisc title 
  include('includes/header.html');
  ?&gt; 
  &lt;?php 
  session_start();
  
  if($_SESSION['usernamne1']==true || ($_POST['username']=="Dexter" 
  &amp;&amp; ($_SESSION['password1']==true || $_POST['password']="meow1"))) {
  $_SESSION['usernamne1']=true;
  echo "Hello Dexter";
  }
  
  elseif($_SESSION['usernamne2']==true || ($_POST['username']=="River" 
  &amp;&amp; ($_SESSION['password2']==true || $_POST['password']="meow2"))) {
  $_SESSION['usernamne2']=true;
  echo "Hello River";
  }
  
  elseif($_SESSION['usernamne3']==true || ($_POST['username']=="Miro" 
  &amp;&amp; ($_SESSION['password3']==true || $_POST['password']="meow3"))) {
  $_SESSION['usernamne1']=true;
  echo "Hello Miro";
  }
  
  else {
  echo "Please login";
  }
  ?&gt;
  
  &lt;?php //Footer include file 
  include('includes/footer.html');
  ?&gt;
  </code></pre>