I am actually trying to detect a person, using a computer, Just like facebook. Whenever you sign into facebook using different machine, it detects the new machine and asks you t
This process has very little to do with cookies, it's called fingerprinting.
Basically, you can look at the functionality and support of your browser and there is a likelihood that the combination will be somewhat unique.
You can test this out here: https://panopticlick.eff.org
JavaScript example, but the theory can be transposed to any language: http://valve.github.io/fingerprintjs2/
Using this in combination with cookies is the best way to detect unique devices. Store the fingerprint in a hidden field when you login and check that against the available fingerprints you've already got.