1.11M Members

What does this code mean?

 
0
 

Ok I might just be being daft here but..

I am into the whole PHP thing at the moment and learning it at a really basic level..

I was on facebook recently and noticed this code in the url after I clicked some of the buttons;

'?ref=home'

This showed up at the end of the url..

obviously the 'home' part of it is the name of the button I clicked..

I just was curious to what this is used for.

Thanks

 
0
 

Ok I might just be being daft here but..

I am into the whole PHP thing at the moment and learning it at a really basic level..

I was on facebook recently and noticed this code in the url after I clicked some of the buttons;

'?ref=home'

This showed up at the end of the url..

obviously the 'home' part of it is the name of the button I clicked..

I just was curious to what this is used for.

Thanks

Guess it could be a couple of things.
A 'go-back' flag to return you to the home page when you leave the other page / website,
or it could be used for visitor tracking stats - telling Facebook where you found the button you clicked on.

 
1
 

It is a "url parameter", basically when the page example.php?ref=home is requested, the server will call the file example.php and serve it's output.

When the script example.php is being run, it can ask the server whether or not the "ref" url parameter is set, and if so what its value is, in this case "home".

So for example, on facebook, you could for example visit photos.php?ref=comments. When photos.php is being loaded, it can see whether or not it should show only photos with comments, or else a default, e.g. all photos.

These parameters can be accessed in PHP via the $_GET array. Let's say a user has clicked a link to example.php?user=dave.

$user= $_GET['user'];

echo "hi" . $user . "!";

As Voyager97 said, this could be used for tracking, and doesn't really have to have anything to do with the link you click on.

Curiosity satisfied? ;p

 
0
 

Good question. When you create a URL link, you can place variables in the URL. If the URL variable was ?ref=home, they could have called this from the URL. A good example of this would be, if you created a link which was http://www.mydomain.com?ref=link, you could have use the $link = $_GET in a form etc.

Obviously the GET function, gets the variable from the URL. Not the safest way to pass variables, but it can be done.

if you put http://www.domain.com?VAR=variable you can call this form a domain.

The most common way I know is for searches.

An example of this would be if you set your domain name as above you could have

$variable = $_GET['url_variable'; 

$query = "SELECT * FROM database_name" .
"WHERE field_name = '$url_variable' ";
$result = mysql_query($query)
or die(mysql_error());
$row = mysql_fetch_array($result);
 
0
 

It seems that they record where you came from.
So if you was at the facebook homepage and you clicked on an ad or fan page or something it knows where you came from.

99% sure its just used for statistics etc

 
0
 

I agree with Clarkeez - My reply was more about how to use it - if you wanted to use it yourself

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article