What page did you come from? referer's usefulness _ PHP Tutorial

Source: Internet
Author: User
It can be used by referer to get the page from which you come. When developing a web program, we sometimes need to get the page from which the user is connected, and the referer is used. It is an http protocol, so any language that can develop a web program can be used to develop a web program. sometimes we need to get the page from which the user is connected, which uses referer.

It is an http protocol, so any language that can develop web programs can be implemented. for example, in jsp (the preferred choice for SUN Enterprise applications), it is:

Request. getHeader ("referer ");

Php (as the mainstream development language) is $ _ SERVER [HTTP_REFERER]. I will not give examples of other languages ).

What can it do? Here are two examples:

1. prevent unauthorized connection. for example, I am a software download website. on the download page, I first use a referer to determine whether the previous page is my own website. if not, it indicates that someone has stolen your connection.

2. for the security of e-commerce websites, I use referer on the pages that submit important information such as credit cards to determine whether the previous page is my own website. if not, it may be a form written by hackers, to skip javascript verification on your previous page.

Notes for using referer:

If I enter a page with a referer in a browser, the return value is null (jsp (preferred for SUN Enterprise applications )), that is to say, the referer will only have content when you click to connect to this page from another page.

Secret is a page with iframe. it embeds a. jsp (the first choice for SUN Enterprise Applications) in iframe. Bytes

Bytes. It is an http protocol, so any language that can develop web programs can...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.