title: Easy login script without database
body: <p>How do I create an easy login script that does not require a database. I would like it to be safe.</p>
  
  <p>Alright, what about this script, i just made it by my knowledge in php.</p>
  
  <pre><code>&lt;?php 
  // Start session
  session_start(); 
  
  // Username and password
  $ID = "admin";
  $pass = "123456";
  
  if (isset($_POST["ID"]) &amp;&amp; isset($_POST["pass"])) { 
  
      if ($_POST["ID"] === $anvandarID &amp;&amp; $_POST["pass"] === $pass) { 
      /
      $_SESSION["inloggedin"] = true; 
  
      header("Location: safe_site.php"); 
      exit; 
      } 
          // Wrong login - message
          else {$wrong = "Bad ID and password, the system could not log you in";} 
  }
  ?&gt; 
  </code></pre>
  
  <p>The safe_site.php contains this and some content:</p>
  
  <pre><code>session_start();
  
  if (!isset($_SESSION["inloggning"]) || $_SESSION["inloggning"] !== true) {
  header("Location: login.php");
  exit;
  }
  </code></pre>