Is there a way you can make a script that will show an image only to people coming from search engines and not to people coming directly to my site?

And is it possible to hide that code somehow?