实例讲解QQ空间莫名欺骗的图片获取QQ号及昵称原理+源码

PHP技术
375
0
0
2022-03-22

直接看代码吧

<?php
$ment =  $_SERVER["HTTP_REFERER"];

if($ment == 'http://cnc.qzs.qq.com/qzone/newblog/v5/editor.html'){
      header("HTTP/1.0 500 Internal Server Error");
      exit;
} 
preg_match("#[0-9]{5,11}#",$ment,$rr);
$r=$rr[0];
$webtext=file_get_contents('http://www.phperzone.cn/qqinfo-service.php?qq='.$r);
preg_match('#"nickname":"(.*?)"#',$webtext,$rr);
$rrr=$rr[1];
ob_clean();
header("Content-type:image/png");
$im=imagecreatefromjpeg("1.jpg");
$black = ImageColorAllocate($im, 56,73,136);
$rrr = mb_convert_encoding($rrr, "utf-8","UTF-8");
imagettftext($im,20,0,90,68,$black,"./simsun.ttc",$rrr);
imagettftext($im,26,0,87,125,$black,"./simsun.ttc",$r);
imagejpeg($im);
imagedestroy($im);
?>