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

Emlog添加QQ快速评论

殷德瑶 2016-5-27 emlog教程 评论 2300 次

具体方式如下:

首先打开medule.php文件,找到//blog:发表评论表单的函数,在


<p class="comment-header"><b>发表评论:</b><a name="respond"></a></p><?php if(ROLE == 'visitor'): ?>


这行下面添加如下代码:

<!--获取QQ号码及用户资料-->
 <?php
                  if(isset($_POST['u'])){
                       header('Content-Type: text/html; charset=utf-8');
                       $ret = '';
                       if(preg_match('/\"nickname\":\"([^\"]+)\"/', file_get_contents('http://r.qzone.qq.com/cgi-bin/user/cgi_personal_card?uin='.$_POST['u']), $QQInfo)){
                       $ret = $QQInfo[1];
                       }
                       echo '<script>parent.document.getElementsByName("comname")[0].value = "',$ret,'";</script>';
                       echo '<script>parent.document.getElementsByName("commail")[0].value = "',$_POST['u'],'@qq.com";</script>';
                       echo '<script>parent.document.getElementsByName("comurl")[0].value = "http://user.qzone.qq.com/',$_POST['u'],'";</script>';
                       }else{?>
                     <?php
                    }
              ?>
<!--获取QQ号码及用户资料 end-->
<p>
<iframe name="hiddenIframe" style="display:none;"></iframe>
<form action="" method="POST" target="hiddenIframe">
<p style="color:#FF262E;">快速评论:请填写QQ获取资料!</p>
<input placeholder="请输入您的QQ号码" value="" type="text" <input style="width:90px;" type="submit" value="获取用户资料">
</form>
</p>


然后在留言页面刷新,这样就可以通过QQ获取用户基本信息了。


发表评论


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