ballhogjoni Posted April 5, 2007 Share Posted April 5, 2007 How would I capture the url of the referring web page? I want to be able to write an If else statement based off of a certain url. basically if someone comes from a certain url I want the script to do one thing and if they come from another url i want the script to do something else. Link to comment https://forums.phpfreaks.com/topic/45774-how-would-i-capture-the-url-of-the-referring-web-page/ Share on other sites More sharing options...
MadTechie Posted April 5, 2007 Share Posted April 5, 2007 Use $_SERVER['HTTP_REFERER'] Link to comment https://forums.phpfreaks.com/topic/45774-how-would-i-capture-the-url-of-the-referring-web-page/#findComment-222349 Share on other sites More sharing options...
ballhogjoni Posted April 5, 2007 Author Share Posted April 5, 2007 thanks mad, would this work correctly? if ($_SERVER['HTTP_REFERER'] == "https://xxxxx.com/ec/checkout/new_order.php") { header("Location:https://xxxx/ec/checkout/new_dcc_confirm.php"); } Link to comment https://forums.phpfreaks.com/topic/45774-how-would-i-capture-the-url-of-the-referring-web-page/#findComment-222351 Share on other sites More sharing options...
ballhogjoni Posted April 5, 2007 Author Share Posted April 5, 2007 anybody? Link to comment https://forums.phpfreaks.com/topic/45774-how-would-i-capture-the-url-of-the-referring-web-page/#findComment-222361 Share on other sites More sharing options...
MadTechie Posted April 5, 2007 Share Posted April 5, 2007 Yes but you might want to add some hashed sessions if its a secure system as REFERER can be spoofed Link to comment https://forums.phpfreaks.com/topic/45774-how-would-i-capture-the-url-of-the-referring-web-page/#findComment-222454 Share on other sites More sharing options...
per1os Posted April 5, 2007 Share Posted April 5, 2007 Yea but the only problem is that HTTP_REFERER can easily be spoofed and some people have it turned off. It is not a very reliable source. Link to comment https://forums.phpfreaks.com/topic/45774-how-would-i-capture-the-url-of-the-referring-web-page/#findComment-222455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.