Security - Login system For a school project I have been asked to create a login system for a website. The language I have to use is PHP with no database as of yet (for a later assignment). I'm just wondering if this code has any security flaws.

Here is my current code:

Navigation.php note that this is to be included in another html document. 

&lt;link type="text/css" rel="stylesheet" href="style_nav.css"&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href="index.php"&gt;Index&lt;/a&gt;&lt;/li&gt;  
    &lt;li&gt;&lt;a href="test.php"&gt;Test&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;not-in-use&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="login" &gt; 
    &lt;?php
    session_start();

    $_SESSION['last_phage'] = $_SERVER['PHP_SELF'];

    if (empty($_SESSION['user'])) { 
        echo '
        &lt;form action="login.php" method="POST"&gt;

        Username: &lt;input type="text" name="username"&gt;
        Password: &lt;input type="password" name="password"&gt;&amp;nbsp;&amp;nbsp;
        &lt;input type="submit" value="Login"&gt;

        &lt;/form&gt;';
    } else {
        echo 'Welcome! ' . $_SESSION['user'] . '&lt;form action="login.php" method="POST"&gt;&lt;input type="submit" value="logout" name="logout"&gt;&lt;/form&gt;';
    }
    ?&gt;

&lt;/div&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;hr /&gt;


Login.php 

&lt;?php

session_start();


if (isset($_POST['logout'])) {
    session_destroy();          
    header("Location: index.php"); 
}

if (isset($_POST['username']) &amp;&amp; isset($_POST['password'])) {
    if (!empty($_POST['username']) &amp;&amp; !empty($_POST['password'])) { 
        $username = $_POST['username']; 
        $password = $_POST['password']; 

        if ($username == 'kad' &amp;&amp; $password == 'lol') {  //this is just temporary without a database
            $_SESSION['user'] = $username;

            header("Location:" . $_SESSION['last_phage']);
        }

        header("Location: " . $_SESSION['last_phage']); 
    }
}
?&gt;
Here's my 2 cents as Java "developer" with a little experience in c# and vba.

Your security here largely depends on whether you send the password and username in clear text or encrypted. You should force HTTPS protocol for access to the page. 

You might also want to show errors if the login is invalid:

$valid = true;
if(!isset($_POST['username']) || empty($_POST['username'])){
   $errors .= "Please enter a username.&lt;br&gt;"
   $valid = false;
}
if(!isset($_POST['password']) || empty($_POST['password'])){
   $errors .= "Please enter a pasword.&lt;br&gt;"
   $valid = false;
}
if($valid){
  //check for username and password compliance
}


Also it would definitely be better to have the logout be handled in a different file than the login