话说QQ群签到玩法一二技巧

作者:@ouyang 发布时间:2015年08月25日 阅读: 2,994 分类:热点话题

QQ推出了群签到,连续签名15天会有橙色名字赐予,对于VIP党来说这可以忽略了。当然最重要的是可以批量进行签名,只要一个PHP文件即可,在服务器上做个定时任务,执行PHP,每天就能够自动签名了,一劳永逸的方法。
将下面代码存为PHP文件即可,放到服务器上或本地运行PHP即可执行你全部的群签到。
Github项目地址:https://github.com/xqin/qiandao

un = preg_replace('/^o0*/', '', $uin);//数字QQ号码
        $this->cookie = sprintf('Cookie: uin=%s; skey=%s;', $uin, $skey);//Cookie

        $this->g_tk = $this->getGTK($skey);//计算 g_tk

        $this->sign($this->getQunList());//获取群列表并签到
    }

    function getGTK($skey){
        $len = strlen($skey);
        $hash = 5381;

        for($i = 0; $i < $len; $i++){
            $hash += ($hash << 5) + ord($skey[$i]);
        }

        return $hash & 0x7fffffff;//计算g_tk
    }

    function getQunList(){
        $html = @file_get_contents(
                sprintf('http://qun.qzone.qq.com/cgi-bin/get_group_list?uin=%s&g_tk=%s', $this->un, $this->g_tk),
                false,
                stream_context_create(array(
                    'http'=>array(
                        'method'=>'GET',
                        'header'=>$this->cookie
                    )
                ))
            );

        preg_match('/(\{[\s\S]+\})/', $html, $qunList);

        if(count($qunList) == 0){
            return NULL;
        }

        $qunList = json_decode($qunList[1]);

        if($qunList == NULL || $qunList->code != 0){
            return NULL;
        }

        return $qunList->data->group;
    }

    function sign($groups){
        if($groups == NULL)return;

        $i = 1;
        foreach($groups as $qun){
            $this->qiandao($qun->groupid);//签到
            printf("%d\t%s(%d)\tok\r\n", $i++, $qun->groupname, $qun->groupid);//输出群信息
        }
    }

    function qiandao($qin){
        @file_get_contents($this->signUrl, false,
            stream_context_create(
                array('http' => array(
                    'method'  => 'POST',
                    'header'  => $this->cookie,
                    'content' => sprintf('gc=%s&is_sign=0&bkn=%s', $qin, $this->g_tk)
                ))
            )
        );
    }
}

这样玩不够爽?能自定义签到内容吗?这当然可以。
准备工具:Chrome和一个抓包工具,可以用Fiddler。
先打开Fiddler,然后打开想要签到的QQ群,点击签到功能(不要点击签到),然后在Fiddler里面能够找到gc和bkn的值。
QQ群BKN值

OK,打开Chrome,然后打开http://qiandao.qun.qq.com/,登录QQ,F12打开开发工具,先引入jq.
引入jq代码:

;(function(d,s){d.body.appendChild(s=d.createElement('script')).src='http://code.jquery.com/jquery-1.9.1.min.js'})(document);

然后(实现自定义签名说明的代码来了。)

$.post("http://qiandao.qun.qq.com/cgi-bin/sign",
	{
		gc:"XX55XXX", //这里填写你获取到的gc值
		is_sign:"0",
		from:"1",
		bkn:"XXX88XXXX", //这里填写你获取到的bkn值
		poi:"群也好久了,对于签到,其实是个苦力活,要签到起码要能够做点广告吧?来吧,来友链一个吧?http://www.joming.com 欢迎来换友链,就这样吧,Joming在此",
	},
	function(data,status)
		{
		alert("数据:"+ data.ec);
		}
	);

好了,检查你刚才打开的群吧。是不是签到成功了?

[基础]if判断不为空的情况执行代码

作者:@ouyang 发布时间:2015年06月09日 阅读: 2,639 分类:学习笔记

{if !empty($description)}

摘要:{$description}

{/if}

if判断如$description不为空的情况下执行代码!