first run of the code (displaying login form), there is no post data.
// these (should) generate warnings, undefined index, since you have no post data
$dbuser= $_POST["username"]; // which means null is assigned to $dbuser
$dbpass = $_POST["passwort"]; // same...
$_SESSION['username']= $dbuser; // same
$_SESSION['passwort']= $dbpass; // same
second run through the code: login form was posted
$dbuser= $_POST["username"]; // now there are values. some string is assigned
$dbpass = $_POST["passwort"]; // same...
$_SESSION['username']= $dbuser; // same
$_SESSION['passwort']= $dbpass; // same
third run through the code: login form was not posted (some other action took place)
well, displaying the code is pointless. The exact same thing happens as in the first run through code.
However
if (isset($_POST['name_of_submit_button'])) {
// or: if (!empty($_POST['username) && !empty($_POST['passwort']))
$SESSIONT['dbuser'] = $dbuser = $_POST["username"];
$SESSIONT['dbpass'] = $dbpass = $_POST["passwort"];
}
else {
$dbuser = $SESSIONT['dbuser'];
$dbpass = $SESSIONT['dbpass'];
}