Can someone give me advice on cleaning this code? It's more messy then I expected. I got like 10-15 more ifs to be added.
I've thought of adding the error messsages in methods and then just check if method returns true, or false it'd throw error..
if( isset($_SESSION["access_token"], $_SESSION["user_email"], $_SESSION["username"]) ){
if($GoogleAccess->does_account_exist){
if(!$GoogleAccess->is_g_acc_banned()){
if(!$GoogleAccess->is_ip_banned()){
if(!$GoogleAccess->is_ip_blacklisted($blacklist_ips)){
if($GoogleAccess->is_user_acc_verified()){
header("location: ../member.php");
}else{
$error = "Please verify your account";
}
}else{
$error = "This IP's blacklisted.";
}
}else{
$error = "Your IP's been banned";
}
}else{
$error = "This account has been banned";
}
}else{
//mean doesn't have account. Register user and send verification to email
}