You can't directly detect a browser's previous history, beyond the "referrer" link: Most browsers give the webserver information about what URL provided the link by which they arrived at the present document. This can be logged by a webserver as "HTTP_REFERER",
Also, affiliated websites can implement a method of cookies that can be read by sister/parent sites, to provide cross-listed data about browsing habits around sites. This kind of activity is frowned on by a large segment of the web-surfing population, but is a hallmark of DoubleClick and other banner ad networks.
Beyond that you are out of luck. Even the methods I describe above are not absolute, as users can delete cookies, or disable the "referrer" data in some browsers. All client-side data should be considered tainted. [sig][/sig]