First, you need to put session_start(); before any exit to the browser, usually at the top of the page. See the manual.
Secondly, this will not affect your results, but these lines are not used anywhere and should be deleted:
$usr = "admin"; $psw = "password"; $username = '$_POST[username]'; $password = '$_POST[password]';
... and the last two lines will not work, you need to put quotation marks in square brackets:
$username = $_POST['username'];
If you put session_start() at the top of the page (i.e. before the <html> , etc.), this should work fine.
Robbie averill
source share