hokie5449 Posted November 30, 2010 Share Posted November 30, 2010 If I do something like header(Location: www.url.com). Is there a way that url.com would be able to get the IP from the server that did the redirect? It looks like $_SERVER["REMOTE_ADDR"] returns the clients IP address which isnt what I need. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/220253-header-redirect-ip/ Share on other sites More sharing options...
taquitosensei Posted November 30, 2010 Share Posted November 30, 2010 what you're looking for is $_SERVER['HTTP_REFERER']; Quote Link to comment https://forums.phpfreaks.com/topic/220253-header-redirect-ip/#findComment-1141404 Share on other sites More sharing options...
Pikachu2000 Posted November 30, 2010 Share Posted November 30, 2010 You could append it to the URL as a GET var. header('Location: http://www.domain.com' . $_SERVER['SERVER_ADDR']); Quote Link to comment https://forums.phpfreaks.com/topic/220253-header-redirect-ip/#findComment-1141405 Share on other sites More sharing options...
hokie5449 Posted November 30, 2010 Author Share Posted November 30, 2010 Can't HTTP_REFERER be altered and therefore not very secure? I need this for security purposes which also rules out appending it to the end of the URL. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/220253-header-redirect-ip/#findComment-1141407 Share on other sites More sharing options...
requinix Posted November 30, 2010 Share Posted November 30, 2010 Can't HTTP_REFERER be altered and therefore not very secure? I need this for security purposes which also rules out appending it to the end of the URL. Then (and pardon my French) you're screwed. By using a redirect like that you're already giving the client some latitude. If you can't trust them to keep the referrer correct then you probably shouldn't be trusting it to redirect properly either. I think the closest you'll get, without establishing some kind of authentication scheme with the other server, would be what Pikachu said: append the server IP to the redirect URL. Quote Link to comment https://forums.phpfreaks.com/topic/220253-header-redirect-ip/#findComment-1141408 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.