More detailed answer:
If you have a weapon that threatens both 10' away AND 5' away (a spiked chain, or if you're Large size or bigger with extended reach), anyone attempting to close with you will take an AoO, unless they started their turn 10' away from you (i.e., you attacked them last turn) and only took a 5' step inwards. A 5' step never draws an AoO if it's the only movement of the turn.
You'll get an AoO since they left a threatened square (10' away) and entered another threatened square (5' away). The AoO takes place in the destination square unless you have the Stand Still psionic Feat, in which case it takes place in the first square. The same applies if they are trying to run away from you; as long as both squares are threatened you can take an AoO.
This is a fundamental weakness of polearms with reach (a Glaive, for example); since they don't threaten adjacent squares, you won't get an AoO as someone closes with you, since they won't be moving between two threatened squares unless they're going perpendicular to you (a stupid move).
Edit: forgot to mention that this only works if they don't have Spring Attack, which prevents the target from taking movement AoOs.