Order of the Stick only references the actual rules tangentially
First of all, that joke relies on the rules of Order of the Stick being slightly different from those in both 3.5 and Pathfinder: in the actual rules, you cannot provoke an Attack of Opportunity from a given enemy more than once per action, so after you first leave an opponent’s threatened square and provoke an Attack of Opportunity from him or her, you are free to continue moving without provoking again for that movement.
Rich Burlew has stated repeatedly that he sticks to the actual rules only when he thinks it’s funny to do so, or it advances the plot.
Dungeons & Dragons 3.5 options
Nonetheless, similar tactics do work, and in 3.5 at least, the Spiked Chain is a pretty good weapon for it (the feat cost hurts quite a lot though). The typical approach is to use a Reach weapon that can Trip (Guisarme or Spiked Chain are the typical choices), take Combat Reflexes and Improved Trip, and trip anyone who tries to move around you too much. This is one of the most effective tactics available to most mundane warriors in 3.5.
Combat Reflexes and Improved Trip, as already mentioned, are key here.
Exotic Weapon Proficiency (Spiked Chain) is a pretty good feat here since you can threaten adjacent squares, but you can also use Spiked Gauntlets, Armor Spikes, and so on with a Guisarme to accomplish similar results. Depends whether or not you have room for another feat.
The Stand Still feat is also quite good for this kind of build, and Knock-Down is also pretty good. Stand Still gives you a good option against those you cannot trip for whatever reason, and Knock-Down effectively doubles your damage against those you can. If you have Tome of Battle, Evasive Reflexes brings you quite a bit closer to how the Order of the Stick character actually works, since it allows you to move back instead of taking an Attack of Opportunity (and it doesn’t count as taking your Attack of Opportunity, which means you still can and he still provokes if he moves forward – you still are only going to get to make one AoO per movement action, though).
Strength or Dexterity bonuses are good, Bonus Feats are great, and Large size is awesome but usually over-priced. I’d probably go with Human (or a Human variant that still gets the Bonus Feat, like Azurin or Silverbrow or whatever), Orc (ideally Water Orc), or a Goliath from Races of Stone for Powerful Build and the possibility of gaining true Large size from Mountain Rage (see below). Half-minotaur is very good template here, also netting you Large size, though like Goliath the LA hurts.
Note that if you do not get Improved Trip as a bonus feat (see Wolf Totem Barbarian, below), you’ll need Int 13 to get Combat Expertise. Note that if you go for a Psychic Warrior or War Mind build, you’ll want some Wisdom.
Barbarian 2 with the Wolf Totem is a great start for such a tripper: you get Improved Trip without taking Combat Expertise, which is great. Rage is useful since Strength covers your Trip checks, and you could switch to Ferocity to get a Dexterity bonus (read: more Attacks of Opportunity) instead of a Constitution bonus. The Lion Spirit Totem alternate class feature from Complete Champion gets you Pounce, which is a great option for any melee build (though it does not directly improve your Trip-lockdown ability).
If you are a Goliath (Races of Stone), you could instead take Mountain Rage, which makes you Large for the duration of your Rage: this is excellent for a Trip-lockdown build.
Also look into the Knockback feat, also from Races of Stone, and consider combining it with Fighter 6 using the Dungeoncrasher ACF from Dungeonscape: you’ll broaden your abilities to do both Bull Rush and Trip. So Barbarian 2/Fighter 6 is not bad for a pretty simple build that has a few options. A couple of levels of Fighter are pretty common for such a character just because you do want a lot of Fighter feats. Don’t take too many, though; after you get your core feats, additional feats frequently matter less and less and you want to get real class features.
You will also want to increase your size as much as you can. Trips involve Touch attacks, which means BAB is not super-important to you: consider levels in Psychic Warrior to get the excellent expansion, not to mention being a fantastic alternative to Fighter for Bonus Feats. The War Mind prestige class is also pretty good for this. Cleric is a great dip in general, and can also get you righteous might, a pretty good size increase. Note that you have to be careful about when you Rage if you are a Barbarian and a spellcaster or manifester.
In Pathfinder, you can still do it, but not with a Spiked Chain, and you need two feats to do what Improved Trip used to do for one, and you’ll burn through your Attacks of Opportunity twice as fast. In short, Paizo decided that one of the few functional mundane tactics in 3.5 was somehow “too good” and nerfed the hell out of it. They also decided that “just because it costs a feat to use” is not a sufficient reason for an exotic weapon to be be better than a martial one, in one of their most derided and bone-headed fiascoes to date, and thus made the Spiked Chain now pretty much useless and in no way worth a feat. It was only barely worth a feat in 3.5.
Being Large would have helped the Pathfinder Spiked Chain situation somewhat since you’d get Reach that way, but it’s still much better off with a Reach weapon than with a non-Reach weapon even when Large, and more importantly there’s still nothing about the Spiked Chain that actually makes it worthwhile. So use a Guisarme or Heavy Flail instead of a Spiked Chain, and still try to increase your size.
Pathfinder also has Stand Still; it’s slightly different (Combat Maneuver check instead of attack plus Reflex Save), but the two are probably close to equal in usefulness. I’m not sure if there are any Pathfinder feats that serve as stand-ins for Knock-Down or Evasive Reflexes, though.