PHP USES REFERER root access to redirect pages

  • 2020-09-16 07:24:40
  • OfStack

For example, I have 1 developer 1 yellow Pages source code that goes to this site. Before ordered a demo address: https: / / www ofstack. com now the domain name needs to be used as other station, don't kill again at the original demo address what failure. Then I can use PHP REFERER to determine the source if it is the address of the downloaded site from the webmaster and I will transfer it to the domain name of the site.

. I am in https: / / www ofstack. com index. On this site php placed in the following code. Let it come from img jbzj. Commonly used com access to my server software download http: / / s ofstack. com

You can go to the demo address on this page


<?php
$referHost = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
$validDomain = 'img.jbzj.com';
$valid = strstr($referHost, $validDomain) == $validDomain;
if(!empty($valid)){
    echo '<script>location.href="http://s.ofstack.com";</script>';
    exit;
}


Related articles: