lisagauss Posted December 22, 2011 Share Posted December 22, 2011 Hoping someone can help. I have a file, say bounce.php that uses php url ramdomizer, like this: <?php $urls = array("link1", "link2"); $url = $urls[array_rand($urls)]; header("Location: http://$url"); ?> What I want is to only allow that code to execute if the user is coming from another php page on the same sever/folder. So like this.... So bounce.php will check where the traffic is coming from.....if traffic is coming from page1.php (file on same server) then it will allow URL REDIRECT CODE to execute, if traffic is coming from another source, such as google.com, or from no referel, then person is sent to another site, say msn.com. Quote Link to comment https://forums.phpfreaks.com/topic/253690-php-redirect-based-on-page-referer/ Share on other sites More sharing options...
MarPlo Posted December 24, 2011 Share Posted December 24, 2011 Hi, To check if the user come from page1.php, you can set a $_SESSION in page1.php, than, in the other page check that session. Quote Link to comment https://forums.phpfreaks.com/topic/253690-php-redirect-based-on-page-referer/#findComment-1301118 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.