殷德瑶博客
喜欢的歌,静静地听!喜欢的人,远远地看!

emlog评论一键获取QQ昵称和头像的代码

殷德瑶 2016-6-5 emlog教程 评论 3713 次

首先在module.php里面加以下代码:

<?php //获取QQ信息
function getqqtx($qq){
	$url="http://q.qlogo.cn/headimg_dl?bs=qq&amp;dst_uin=$qq&amp;src_uin=qq.feixue.me&amp;fid=blog&amp;spec=100";
	return $url;}
	if(isset($_POST['qq'])){
	$spurl = "http://r.pengyou.com/fcg-bin/cgi_get_portrait.fcg?uins={$_POST['qq']}";
	$data = file_get_contents($spurl);
	$nc=explode('"',$data);
	$s=$nc[5];
	$bm=mb_convert_encoding($s,'UTF-8','UTF-8,GBK,GB2312,BIG5');
	if(empty($bm)){echo '<script>parent.document.getElementsByName("comname")[0].value = "QQ账号错误";parent.document.getElementsByName("commail")[0].value = "QQ账号错误";parent.document.getElementsByName("comurl")[0].value = "QQ账号错误";</script>';}
	else{echo '<script>parent.document.getElementsByName("comname")[0].value = "'.$bm.'";parent.document.getElementsByName("commail")[0].value = "'.$_POST['qq'].'@qq.com";parent.document.getElementsByName("comurl")[0].value = "http://user.qzone.qq.com/'.$_POST['qq'].'";parent.document.getElementById("toux").src="http://q.qlogo.cn/headimg_dl?bs=qq&amp;dst_uin='.$_POST['qq'].'&amp;src_uin=qq.feixue.me&amp;fid=blog&amp;spec=100";</script>';} }
function getqqxx($qq){	
	$ssud=explode("@",$qq,2);
	if($ssud[1]=='qq.com'){
	echo getqqtx($ssud[0]);
	}else{	
	echo MyGravatar($qq);	
}}
?>

然后继续在module.php里面找到getGravatar($comment['mail'])这个替换成getqqtx($comment['mail'])一共有两个好像。反正都有的话就都换了

然后在你的发表评论那些代码里加上以下代码:

 <form action="" method="post" target="hiddenIframe">
      <li>
        <input placeholder="选填" value="" type="text" name="qq"/>
        <label for="author"><i class="fa fa-qq"></i>QQ : </label>
        <button type="submit" id="hqziliao">获取信息</button>
      </li>
    </form>


发表评论


粤ICP备15078261号 Powered by 黑暗之夜
Theme by 殷德瑶博客