Look, your code is kinda strange it self...
Checks if user has all flags but not LEVEL B, C, D? WTF? How is it possible that user have all flags but not all?
PHP Code:
if(rank4 && !rank3 && !rank2 && !rank1)
{
RankName[id] = PLAYER;
}
I don't know... Lol. Your code is soo confusing...