skeg0 Posted March 27, 2006 Share Posted March 27, 2006 can anyone help with this! it isnt working and i dont know why. i just want the code to check where a person has come from (referer) and view an appropriate php menu screen...if ($HTTP_REFERER == 'www.something.com/123.php') require('123_top_template.php');else require('top_template.php');any suggestions??cheers Quote Link to comment https://forums.phpfreaks.com/topic/5929-is-my-syntax-correct/ Share on other sites More sharing options...
shocker-z Posted March 27, 2006 Share Posted March 27, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]if ($HTTP_REFERER == 'http://www.something.com/123.php') {require('123_top_template.php');}else {require('top_template.php');}[/quote]if you do: "echo $HTT_REFERER" you will notice that it includes the http:// Quote Link to comment https://forums.phpfreaks.com/topic/5929-is-my-syntax-correct/#findComment-21205 Share on other sites More sharing options...
trq Posted March 27, 2006 Share Posted March 27, 2006 Its $_SERVER['HTTP_REFERER'], and its also a tad unreliable as it depends heavily on the client. Anyway... the syntax would be...[code]if ($_SERVER['HTTP_REFERER'] == 'http://www.something.com/123.php') { require '123_top_template.php';} else { require 'top_template.php';}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5929-is-my-syntax-correct/#findComment-21207 Share on other sites More sharing options...
Guest footballkid4 Posted March 27, 2006 Share Posted March 27, 2006 The previously two posted codes would both work. 1) We assume that he knows at least part of what he's doing, and would understand that register_globals is on therefore it would be $HTTP_REFERER. 2) You don't need brackets around the if statements, as long as there's only going ot be one line of response to the statement. 2) Thorpe is right, HTTP_REFERER depends very heavily on the client. If the client doesn't send the header, you don't get it...A lot of the lower end clients that some people seem to like don't have it. Quote Link to comment https://forums.phpfreaks.com/topic/5929-is-my-syntax-correct/#findComment-21214 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.