saltedm8 Posted February 15, 2011 Share Posted February 15, 2011 would anyone please help me work out why this is not working and even if I use the || operators it still wont work <?php $referer = $_SERVER['HTTP_REFERER']; if ($referer != 'http://digitalpixels.co.uk/portfolio' ) header('Location: http://digitalpixels.co.uk/404/') ; if ($referer != 'http://digitalpixels.co.uk/windscreen-repair-company' ) header('Location: http://digitalpixels.co.uk/404/') ?> thank you Link to comment https://forums.phpfreaks.com/topic/227728-very-simple-but-i-am-being-very-dumb/ Share on other sites More sharing options...
trq Posted February 15, 2011 Share Posted February 15, 2011 Not unless you tell us what 'not working' means. Link to comment https://forums.phpfreaks.com/topic/227728-very-simple-but-i-am-being-very-dumb/#findComment-1174472 Share on other sites More sharing options...
litebearer Posted February 15, 2011 Share Posted February 15, 2011 definition of not working: over 65 = retired 13=64 = unemployed 0-12 = enjoying the wonders of the world Link to comment https://forums.phpfreaks.com/topic/227728-very-simple-but-i-am-being-very-dumb/#findComment-1174496 Share on other sites More sharing options...
ignace Posted February 15, 2011 Share Posted February 15, 2011 You need to add an exit after header like so: $referer = $_SERVER['HTTP_REFERER']; if ($referer != 'http://digitalpixels.co.uk/portfolio') { header('Location: http://digitalpixels.co.uk/404/') ; exit(0); } if ($referer != 'http://digitalpixels.co.uk/windscreen-repair-company') { header('Location: http://digitalpixels.co.uk/404/'); exit(0); } Link to comment https://forums.phpfreaks.com/topic/227728-very-simple-but-i-am-being-very-dumb/#findComment-1174632 Share on other sites More sharing options...
cyberRobot Posted February 15, 2011 Share Posted February 15, 2011 It's a little difficult to tell what the issue is, but it seems you would want to merge the two ifs. If it's not 'portfolio' and not 'windscreen-repair-company', redirect to 404: <?php $referer = $_SERVER['HTTP_REFERER']; if ($referer != 'http://digitalpixels.co.uk/portfolio' && $referer != 'http://digitalpixels.co.uk/windscreen-repair-company') { header('Location: http://digitalpixels.co.uk/404/') ; exit(0); } ?> Link to comment https://forums.phpfreaks.com/topic/227728-very-simple-but-i-am-being-very-dumb/#findComment-1174635 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.