Probably the easiest solution is to not redirect in the server behavior at all, then save the UserType as a session variable and manually add the redirect after the authentication runs like:
<?php
if ([use same trigger as authentication]) {
if (isset($_SESSION['UserType']) && $_SESSION['UserType'] == "user") {
header("location: user-control-panel.php");
die();
}
if (isset($_SESSION['UserType']) && $_SESSION['UserType'] == "admin") {
header("location: admin-control-panel.php");
die();
}
}
?>
Either that or you could just apply the server behavior twice.on the page and don't set a failed redirect so that if the first one doesn't log in the second will. Then in the php below just do the failed redirect like:
<?php
if ([use same trigger as authentication]) {
header("location: login.php?failed=1");
die();
}
?>