When testing conditionals in PHP with ||, PHP will test the conditionals in the order they are written and if one of them is true, the whole conditional evaluates to true. This means that for your code if the value of $_GET['action'] is 'messages', the conditional will evaluate to true:
if ( isset($_GET['action']) && ($_GET['action'] !== "login" || $_GET['action'] !== "messages") ){
doAction();
}
Because when the interpreter evaluates $_GET['action'] !== "login" and the value of $_GET['action'] is 'messages', the result of that evaluation is true and thus the code in the if block will be executed. I recommend you change your code to:
if ( isset($_GET['action']) && ($_GET['action'] !== "login" && $_GET['action'] !== "messages") ){
doAction();
}
The || is changed into && and this means that the value of $_GET['action'] cannot be 'login' and it cannot be 'messages'.