You get that error because when you access the page directly (rather than via a form submission) then the $POST values are not set, so you are attempting to access indexes of the $POST array which do not exist, in these lines:
$username = clean_input($_POST['username']);
$password = clean_input($_POST['password']);
Probably you should add some sort of conditional statement around the form processing code so that it only gets executed if the form has been submitted, e.g.:
if(isset($_POST['username']) and isset($_POST['password']))
{
// process the form input here
}