How can I get the IP of someone and then check if this specific user has already created 2 users ? 

Like, if this ip: xx.xx.xxx.xx has already successfully registered 2 users then cancel his third registration. 

How can I do that?