/ Published in: PHP
A back button that detects if the visitor came from your site initially. If they came from another URL it sends them to your index page instead.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $mysite = "http://www.theUrlOfYourSite.com"; ?> if ($url['host'] == $_SERVER['HTTP_HOST']) { /* if domain matches, go back */ echo $_SERVER['HTTP_REFERER']; } else { echo $mysite; } ?>"><!-- if from another domain, send them to my index page -->Back a page</a>