Hmm, not exactly sure what you are getting at, but I'll have a go.
I would have thought that a user wouldn't have 20 ips, most people tend to access the net from the same 2/3 computers.
Where are you storing the posts & ips? In a database? If so you can extract the data using ORDER BY and your date field and then just use the first two.
Or you need to stick them in an array and perform a sort. A bubble sort will be easiest to explain, but not very efficient.
Basically in a bubble sort you compare value 1 & 2 if 2 is smaller than one you swap them around. then you do the same with 2 & 3 and so on until you reach the end. Repeat until there are no swaps.
Hope that helps point you in the right direction.
-- Nick Gushlow.