nicholaspaul Posted August 26, 2008 Share Posted August 26, 2008 I need to make sure that visitors to a webpage were directed from a certain other web page (ie., they didn't just type in the URL). Can i do this with $_SERVER['HTTP_REFERER'] ? The logic I'm thinking is: If $_SERVER['HTTP_REFERER'] is not www.payhere.com, then header ("Location: http://www.domain.com/error.html"); How might I go about this? My php knowledge is a bit ... limited. Any and all help appreciated! Thanks. Link to comment https://forums.phpfreaks.com/topic/121359-website-security-with-headers-need-help-quick/ Share on other sites More sharing options...
Third_Degree Posted August 26, 2008 Share Posted August 26, 2008 what's wrong with your logic? Link to comment https://forums.phpfreaks.com/topic/121359-website-security-with-headers-need-help-quick/#findComment-625715 Share on other sites More sharing options...
nicholaspaul Posted August 26, 2008 Author Share Posted August 26, 2008 I dont think anything is wrong with my logic. How would I code this (I know its going at the beginning of the download page) ? Link to comment https://forums.phpfreaks.com/topic/121359-website-security-with-headers-need-help-quick/#findComment-625718 Share on other sites More sharing options...
Third_Degree Posted August 26, 2008 Share Posted August 26, 2008 if ( $_SERVER['HTTP_REFERER'] != 'somepage' ) { die( header( "Location: whatever.html" ) ); } Link to comment https://forums.phpfreaks.com/topic/121359-website-security-with-headers-need-help-quick/#findComment-625721 Share on other sites More sharing options...
nicholaspaul Posted August 26, 2008 Author Share Posted August 26, 2008 Thanks mate - youre a life saver. I just didnt want to spend all day looking for a lost bracket or something!!! Thanks again! (I'll let you tomorrow how it works) Link to comment https://forums.phpfreaks.com/topic/121359-website-security-with-headers-need-help-quick/#findComment-625723 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.