I want to make a single login for just 1 user without storing in a database but I can\'t seem to get this to work.
My code: login.php
&
Firstly, you need to put session_start(); before any output to the browser, normally at the top of the page. Have a look at the manual.
Second, this won't affect your results, but these lines aren't being used anywhere and should be removed:
$usr = "admin";
$psw = "password";
$username = '$_POST[username]';
$password = '$_POST[password]';
...and the last two lines there wouldn't work, you need to put the quotes inside the square brackets:
$username = $_POST['username'];
If you put session_start() at the top of your page (i.e. before the tag etc), this should work fine.