Http_referer

chinmay.sahoo

New member
This variable contains the URL of the page the user viewed prior to the one he or she is currently viewing. Keep in mind when using HTTP_REFERER that not every page request has a referer. If someone types the URL into a browser, or gets to your page via bookmarks, no referer will be sent. This variable can be used to present customized information. If you had a relationship with another site and wished to
serve up a special, customized header for only those referred from that domain you might use a script like this.

//check if my user was referred from my_partners_domain.com
if(ereg (“http.*my_partners_domain.com.*” , $HTTP_REFERER))
{
include’fancy_header.php’;
}else{
include’normal_header.php’;
}

Keep in mind that HTTP_REFERER is notoriously unreliable. Different browsers serve up different
HTTP_REFERER s in certain situations. It is also easily spoofed. So you wouldn ’t want to use a script like the preceding one to serve any secure infor-mation. I worked on a site where HTTP_REFERER
was used to determine if a special GIF should be included in the header
 
Back
Top