Home >Backend Development >PHP Tutorial >PHP fake source information instance method

PHP fake source information instance method

小云云
小云云Original
2018-03-14 13:06:171675browse

This article mainly shares with you the example method of forging source information in PHP. This article mainly shares it with you in the form of code. I hope it can help you.

function getUrl($address, $myip)
{   
   ob_start();   
   $mtime =
explode(' ',
microtime());   
   $starttime =
$mtime[1] +
$mtime[0];   
  
   $onoff =
(function_exists('ini_get')) ? ini_get('register_globals') :
get_cfg_var('register_globals');   
  
   if($onoff !=
1) {   
       @extract($_POST,
EXTR_SKIP);   
       @extract($_GET,
EXTR_SKIP);   
   }   
  
   $self =
$_SERVER['PHP_SELF'];   
   $myaddress =
'http://'.$_SERVER['HTTP_HOST'].$self;   
  
   $comm =
'';   
  
   if(isset($url) && $url)
{   
       $url = str_replace($address, '',
$url);   
   }   
     
   $pcomm =
'';   
   foreach($_POST as $key => $val)
{   
       if($pcomm == '')
{   
           $pcomm .=
$key.''.urlencode($val);   
       } else
{   
           $pcomm .=
$pcomm.'&'.$key.'='.urlencode($val);   
       }   
   }   
  
   foreach($_GET as $key => $val)
{   
       if($key != 'url')
{   
           if($comm == '')
{   
               $comm =
$key.'='.rawurlencode($val);

Related recommendations:

referer PHP fake referer example code

php fake referer Use referer to prevent image hotlinking

PHP fake referer example code

The above is the detailed content of PHP fake source information instance method. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn