The Ascension Project
When making a melee attack, you get a +2 flanking bonus if your opponent is threatened by a character or creature friendly to you on the opponent’s opposite border or opposite corner. When in doubt about whether two friendly characters flank an opponent in the middle, trace an imaginary line between the two friendly characters’ centers. If the line passes through opposite borders of the opponent’s space (including corners of those borders), then the opponent is flanked.
Exception: If a flanker takes up more than 1 square, it gets the flanking bonus if any square it occupies counts for flanking. Only a creature or character that threatens the defender can flank so creatures with a reach of 0 feet can’t do it.
When making a ranged attack, there is no inherent bonus to flanking attacks. Ranged flanking involves maneuvering around the targets cover, thereby negating it. This basically grants the attack a, +2, +4, +7, and +10 respectively.