exploit-you Posted June 16, 2011 Share Posted June 16, 2011 I have managed to get php installed and everything setup correctly however the redirect.php file is not picking up the URL i enter. In this file i have the following: <?php $ref = $_SERVER['HTTP_REFERER']; if (strpos($ref, "facebook")) { header('Location: facebook.html'); } else{ require('peets.html'); } ?> If i echo $ref there is no data in it. Do i have to enter the ref command into the index.html file and post it across to the redirect.php? PHP is diffrent installed correctly as i can echo stuff however just not getting any data entered for $ref. Anyone know how to get around this problem? Quote Link to comment Share on other sites More sharing options...
Sparda Posted June 16, 2011 Share Posted June 16, 2011 The referer is the URL of the page that told the browser to load another file. Quote Link to comment Share on other sites More sharing options...
UnDeFiNeD Posted June 17, 2011 Share Posted June 17, 2011 (edited) Some browsers dont set the referrer variable, or maybe you are hitting the page directly, it won't work unless you have dns masquerading set up correctly and hit facebook.com/index.html hosted on the pineapple. If you just hit the redirect.php, there won't be a redirect set because you weren't redirected from anywhere. If you still can't get it working, maybe try using javascript on the html page to get the window.location and send that as a get request to the redirect.php file... Edited June 17, 2011 by UnDeFiNeD Quote Link to comment Share on other sites More sharing options...
digininja Posted June 21, 2011 Share Posted June 21, 2011 I mentioned this to Darren when he first released the script, I'd personally go for checking $_SERVER['HTTP_HOST'] instead of the referrer as it checks the URL you have not the one where you came from. Try changing HTTP_REFERER to HTTP_HOST and see if that fixes it. Quote Link to comment Share on other sites More sharing options...
UnDeFiNeD Posted June 21, 2011 Share Posted June 21, 2011 I mentioned this to Darren when he first released the script, I'd personally go for checking $_SERVER['HTTP_HOST'] instead of the referrer as it checks the URL you have not the one where you came from. Try changing HTTP_REFERER to HTTP_HOST and see if that fixes it. :) sounds good to me, another thing to consider is using include() or echo file_get_contents() in the index.php page instead of just redirecting to the html page. I would also have liked to point my 404 errors to the redirect page, but idk how to set this webserver up for that... Quote Link to comment Share on other sites More sharing options...
billyblaxsta Posted June 22, 2011 Share Posted June 22, 2011 I mentioned this to Darren when he first released the script, I'd personally go for checking $_SERVER['HTTP_HOST'] instead of the referrer as it checks the URL you have not the one where you came from. Try changing HTTP_REFERER to HTTP_HOST and see if that fixes it. Unfortunately using Ubuntu Firefox 3.6.17 I have the same problem irrespective of whether I use HTTP_HOST or HTTP_REFERER. Quote Link to comment Share on other sites More sharing options...
digininja Posted June 22, 2011 Share Posted June 22, 2011 This is how I think it should look: <?php $ref = $_SERVER['HTTP_HOST']; if (strpos($ref, "facebook")) { header('Location: facebook.html'); exit; } else { require('peets.html'); exit; } ?> Quote Link to comment Share on other sites More sharing options...
billyblaxsta Posted June 22, 2011 Share Posted June 22, 2011 (edited) This is how I think it should look: <?php $ref = $_SERVER['HTTP_HOST']; if (strpos($ref, "facebook")) { header('Location: facebook.html'); exit; } else { require('peets.html'); exit; } ?> Sorry...same problem as before. Thanks for all your support - much appreciated! Edited June 22, 2011 by billyblaxsta Quote Link to comment Share on other sites More sharing options...
digininja Posted June 22, 2011 Share Posted June 22, 2011 Can we pull this into one thread, two competing ones is going to miss something. Stop this one and use the other. Alternate thread Quote Link to comment 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.