Jump to content

Archived

This topic is now archived and is closed to further replies.

skeg0

is my syntax correct?

Recommended Posts

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

Share this post


Link to post
Share on other sites
[!--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://

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Guest footballkid4
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.