Hi there - I've been battling with a headers.tpl file for a week now. I've finally got it behaving the way I want it with this piece of code:
<?php
if($_SERVER['HTTP_REFERER']=='http://www.floathousebooks.com/services.html' || $_SERVER['HTTP_REFERER']=='http://www.floathousebooks.com/addons.php' || $_SERVER['HTTP_REFERER']=='http://www.floathousebooks.com/addons.php?added=1'){
header("Location:http://www.floathousebooks.com/addons.php?added=1");
}
?>
i.e., if the webpage that uses the headers.tpl file is being accessed from one of the three pages listed in the code given above, the page will redirect the user to "http://www.floathousebooks.com/addons.php?added=1". However, if I go to the page that uses this headers.tpl file without coming from one of those three pages (and users of my site will have to do that), the page gives the following error:
Notice: Undefined index: HTTP_REFERER in /hermes/web12a/b1229/moo.floathousebookscom/opencart/upload/catalog/view/theme/default/template/common/header.tpl on line 2Notice: Undefined index: HTTP_REFERER in /hermes/web12a/b1229/moo.floathousebookscom/opencart/upload/catalog/view/theme/default/template/common/header.tpl on line 2Notice: Undefined index: HTTP_REFERER in /hermes/web12a/b1229/moo.floathousebookscom/opencart/upload/catalog/view/theme/default/template/common/header.tpl on line 2
which is bizarre, as the code works. I wouldn't expect the code to work if I'm not defining the referer properly. I've read elsewhere that I can suppress the error message with
error_reporting(E_ALL ^ E_NOTICE);
- but I'm a bit uncomfortable with just suppressing it, instead of actually fixing it (despite the fact that it seems to be working all the same).
The most likely source of the error is between my seat and my keyboard - I've probably made a syntax mistake or something, and I haven't developed a keen enough eye to spot it. Any advice?