How to display a BACK button but ONLY if the user came from somewhere else on my site
There are many ways to do this.
One of it would be to use $_SERVER['HTTP_REFERER'] to detect where the user comes from.

Put the following code in your template file. 

if (strstr($_SERVER['HTTP_REFERER'], 'facebook.com') !== false) {
     // Facebook brought me to this page.
     print '&lt;a href="javascript: history.go(-1)"&gt;Go Back&lt;/a&gt;';  }