分享喵
分享我们的收藏

Emlog添加QQ评论并自动获取相关信息教程

本文转载自小草窝,以emlog大前端主题为示例

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

  1. <?php //获取QQ信息
  2. function getqqtx($qq){
  3. $url="https://q.qlogo.cn/headimg_dl?bs=qq&amp;dst_uin=$qq&amp;src_uin=qq.feixue.me&amp;fid=blog&amp;spec=100";
  4. return $url;}
  5. if(isset($_POST[’qq’])){
  6. if(empty($_POST[’qq’])){
  7. echo "@@({comname:’QQ账号错误’,commail:’QQ账号错误’,comurl:’QQ账号错误’,toux:’https://q.qlogo.cn/headimg_dl?bs=qq&dst_uin=34109680&src_uin=qq.feixue.me&fid=blog&spec=100’})@@";
  8. return ;
  9. }
  10. $spurl = "https://r.pengyou.com/fcg-bin/cgi_get_portrait.fcg?uins={$_POST[’qq’]}";
  11. $data = file_get_contents($spurl);
  12. $nc=explode(’"’,$data);
  13. $s=$nc[5];
  14. $bm=mb_convert_encoding($s,’UTF-8’,’UTF-8,GBK,GB2312,BIG5’);
  15. if(empty($bm)){echo "@@({comname:’QQ账号错误’,commail:’QQ账号错误’,comurl:’QQ账号错误’,toux:’https://q.qlogo.cn/headimg_dl?bs=qq&dst_uin=34109680&src_uin=qq.feixue.me&fid=blog&spec=100’})@@";}
  16. else{echo "@@({comname:’{$bm}’,commail:’{$_POST[’qq’]}@qq.com’,comurl:’https://user.qzone.qq.com/{$_POST[’qq’]}’,toux:’https://q.qlogo.cn/headimg_dl?bs=qq&dst_uin={$_POST[’qq’]}&src_uin=qq.feixue.me&fid=blog&spec=100’})@@";}}
  17. function getqqxx($qq,$role=’’){
  18. if(!empty($role)){
  19. return $role;
  20. }
  21. $ssud=explode("@",$qq,2);
  22. if($ssud[1]==’qq.com’){
  23. return getqqtx($ssud[0]);
  24. }else{
  25. return MyGravatar($qq,$role);
  26. }}
  27. ?>

直接加在module最后一行即可,然后在module.php 472行上面添加以下代码

	





  1. <div id="loging"> </div>
  2. <div class="form-group">
  3. <div class="comment-form-author form-group has-feedback"> <div class="input-group"> <div class="input-group-addon"><i class="fa fa-qq"></i></div> <input class="form-control" placeholder="QQ号码" id="qqnum" name="qqnum" type="text" size="30" value="" onblur="huoquqq()"> </div> </div>
  4. </div>

添加完后:

e62ffba10ae25fa9932d6acfdb91a22c20161029054212 - Emlog添加QQ评论并自动获取相关信息教程

然后继续在module.php里面找到

myGravatar

这个替换成

getqqtx

有多少就替换多少吧

然后

getqqtx($email,$role=’’

修改替换成

myGravatar($email,$role=’’

接着

module.php搜索images/noAvator.jpg

加上id=”toux”

0c9b741d50d78bc01b3b7a351ff803f520161029054212 - Emlog添加QQ评论并自动获取相关信息教程

最后

在main.js添加

  1. function huoquqq() {
  2. $(’#loging’).html(’<img src="https://www.wemcc.com/content/templates/vivid/img/loading.gif"><a style="font-size:12px;margin-left:5px;">u6b63u5728u83b7u53d6QQu4fe1u606f..</a>’);
  3. var urls = window.location.href;
  4. $.ajax({
  5. url: urls,
  6. type: "POST",
  7. data: {
  8. "qq": $(’#qqnum’).val()
  9. },
  10. dataType: "html",
  11. success: function(c) {
  12. var josn = eval("" + c.split(’@@’)[1].split(’@@’)[0] + "");
  13. $(’#loging’).html(" ");
  14. $(’#comname’).val(josn.comname);
  15. $(’#commail’).val(josn.commail);
  16. $(’#comurl’).val(josn.comurl);
  17. $(".none_user").html(josn.comname);
  18. $(’#toux’).attr("src", josn.toux);
  19. }
  20. });
  21. }

本站信息除喵叔原创外均来源于网络,信息可靠性请自行辨别,本站不负责相应的法律责任!交流群:512346889;转载请加超链接注明:分享喵 » Emlog添加QQ评论并自动获取相关信息教程

评论 10

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

    Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  1. #0

    @油条:.。

    喵叔2051年前 (-0001-11-30)回复

  2. Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  3. #0

    [汗]

    油条2051年前 (-0001-11-30)回复

  4. Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  5. #0

    [调戏]不错

    渍渍渍2051年前 (-0001-11-30)回复

  6. Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  7. #0

    @渍渍渍:嘻嘻

    喵叔2051年前 (-0001-11-30)回复

  8. Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  9. #0

    [愤怒][愤怒]

    5555552051年前 (-0001-11-30)回复

  10. Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  11. #0

    知道怎么添加表情吗[微笑]

    CH时光、2051年前 (-0001-11-30)回复

  12. Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  13. #0

    @心已成佛:可能失效了,新主题自带这个功能

    喵叔2051年前 (-0001-11-30)回复

  14. Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  15. #0

    为什么我的就是不成功?

    心已成佛2051年前 (-0001-11-30)回复

  16. Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  17. #0

    大神

    想学免流技术2051年前 (-0001-11-30)回复

  18. Warning: A non-numeric value encountered in /www/wwwroot/www.fxmiao.net/wp-content/themes/dux/modules/mo_comments_list.php on line 26
  19. #0

    大神

    想学免流技术2051年前 (-0001-11-30)回复