Maison > développement back-end > tutoriel php > PHP中伪造HTTP_REFERER代码_PHP教程

PHP中伪造HTTP_REFERER代码_PHP教程

WBOY
Libérer: 2016-07-13 17:42:28
original
726 Les gens l'ont consulté

 

<ol class="dp-xml">
<li class="alt"><span><span>error_reporting( E_ERROR | E_WARNING | E_PARSE );  </span></span></li>
<li><span>set_time_limit(0); </span></li>
<li class="alt"><span> </span></li>
<li>
<span>$</span><span class="attribute">server</span><span>  = </span><span class="attribute-value">www.2cto.com</span><span>;   // IP address  </span>
</li>
<li class="alt">
<span>$</span><span class="attribute">host</span><span>    = </span><span class="attribute-value">www.2cto.com</span><span>;   // Domain name  </span>
</li>
<li>
<span>$</span><span class="attribute">target</span><span>  = </span><span class="attribute-value">/test.php?x=1</span><span>;    // Specific program  </span>
</li>
<li class="alt">
<span>$</span><span class="attribute">referer</span><span> = </span><span class="attribute-value">http://www.php100.net/down/redirect.php?x=downurl&id=39&urlid=65</span><span>;    // Referer  </span>
</li>
<li>
<span>$</span><span class="attribute">port</span><span>    = </span><span class="attribute-value">80</span><span>; </span>
</li>
<li class="alt"><span> </span></li>
<li>
<span>$</span><span class="attribute">re</span><span> = </span><span class="attribute-value">fsockopen</span><span>($server, $port, $errno, $errstr, 30);  </span>
</li>
<li class="alt"><span>if (!$re){  </span></li>
<li>
<span>   echo "</span><span class="tag"><span class="tag-name">h1</span><span class="tag">></span><span>无法连接远程服务器</span><span class="tag"></span><span class="tag-name">h1</span><span class="tag">></span><span class="tag"><span class="tag-name">h3</span><span class="tag">></span><span>$errstr ($errno)</span><span class="tag"></span><span class="tag-name">h3</span><span class="tag">/></span><span>
";  </span></span></span>
</li>
<li class="alt"><span>}   </span></li>
<li><span>else {  </span></li>
<li class="alt">
<span> $</span><span class="attribute">strhead</span><span> = </span><span class="attribute-value">"GET $target HTTP/1.1
"</span><span>;  </span>
</li>
<li>
<span> $strhead </span><span class="attribute">.</span><span>= </span><span class="attribute-value">"Host: $host
"</span><span>;  </span>
</li>
<li class="alt">
<span> //$strhead </span><span class="attribute">.</span><span>= </span><span class="attribute-value">"Cookie: PHPSESSIONIDSQTBQSDA=DFCAPKLBBFICDAFMHNKIGKEG
"</span><span>;  </span>
</li>
<li>
<span> $strhead </span><span class="attribute">.</span><span>= </span><span class="attribute-value">"Referer: $referer
"</span><span>;  </span>
</li>
<li class="alt">
<span> $strhead </span><span class="attribute">.</span><span>= </span><span class="attribute-value">"Connection: Close

"</span><span>;</span>
</li>
<li><span> </span></li>
<li class="alt"><span> fwrite($re, $strhead);  </span></li>
<li><span> while (!feof($re)){  </span></li>
<li class="alt"><span>  echo fgets($re, 128);  </span></li>
<li><span> }  </span></li>
<li class="alt"><span> fclose($re);  </span></li>
<li><span>}  </span></li>
<li class="alt"><span> </span></li>
</ol>
Copier après la connexion

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486043.htmlTechArticleerror_reporting(E_ERROR|E_WARNING|E_PARSE); set_time_limit(0); $ server = www.2cto.com ;//IPaddress $ host = www.2cto.com ;//Domainname $ target = /test.php?x=1 ;//Specificprogram...
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal