Guest User

Untitled

a guest
Jan 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php // Back link to previous page.
  2.  
  3. // If current page has been called by a hyperlink.
  4. if(isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] !='') echo '<a href="'.$_SERVER['HTTP_REFERER'].'">&laquo; Go back.</a>';
  5.  
  6. // If current page has NOT been called by a hyperlink.
  7. else return;
  8. ?>
  9.  
  10. if(!empty($_SERVER['HTTP_REFERER']))
  11. {
  12. if(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) == $_SERVER['HTTP_HOST'])
  13. {
  14. echo '<a href="'.htmlentities($_SERVER['HTTP_REFERER']).'">&laquo; Go back.</a>';
  15. }
  16. }
Add Comment
Please, Sign In to add comment