nitestarz Posted March 12, 2013 Share Posted March 12, 2013 I recently upgraded servers and the following code that worked on my old server with php 4x does not seem to work on the new server using 5x. Basically it is an "Email a Friend" form that includes the referring url in the message. Everything else is fine except for this. Any help would be appreciated. If you need any more info, let me know. session_start(); if(!isset($_SESSION['referrer'])){ //get the referrer if ($_SERVER['HTTP_REFERER']){ $referrer = $_SERVER['HTTP_REFERER']; } else{ $referrer = "http://www.domain.com"; } //save it in a session $_SESSION['referrer'] = $referrer; } Quote Link to comment https://forums.phpfreaks.com/topic/275550-php-refferer-and-sessions/ Share on other sites More sharing options...
AyKay47 Posted March 12, 2013 Share Posted March 12, 2013 Sounds like the new server does not provide the HTTP_REFERER entry. You should not depend on this information anyway as some User-Agents do not provide it and it can be spoofed. Quote Link to comment https://forums.phpfreaks.com/topic/275550-php-refferer-and-sessions/#findComment-1418194 Share on other sites More sharing options...
nitestarz Posted March 12, 2013 Author Share Posted March 12, 2013 What do you recommend for another way? Quote Link to comment https://forums.phpfreaks.com/topic/275550-php-refferer-and-sessions/#findComment-1418196 Share on other sites More sharing options...
AyKay47 Posted March 12, 2013 Share Posted March 12, 2013 Unfortunately that information is provided by the server so you would need to contact your hosting provider. I do not know of another way to display that information. Quote Link to comment https://forums.phpfreaks.com/topic/275550-php-refferer-and-sessions/#findComment-1418201 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.