Surely this is wrong:
if ($USERS[$_POST["username"]]==$_POST["password"]) { /// check if submitted
username and password exist in $USERS array
If you have a $USERS array that stores the username then it should be that posted plus put your post data in single quotes and also I think your username and password exist..... is a comment, so it should be:
if ($_POST['USERS']['username']==$_POST['password']) { /// check if submitted
// username and password exist in $USERS array
Or even more simply (as I am not sure why you are storing username in an array:
if ($_POST['username'] == $_POST['password']) {