Esempio n. 1
0
function getimgver($username)
{
    $rand = time() . rand(100, 999);
    $url = "https://mp.weixin.qq.com/cgi-bin/verifycode?username={$username}&r=" . $rand;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    // 对认证证书来源的检查
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    // 从证书中检查SSL加密算法是否存在
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    $output = curl_exec($ch);
    curl_close($ch);
    list($header, $body) = explode("\r\n\r\n", $output);
    preg_match_all("/set\\-cookie:([^\r\n]*)/i", $header, $matches);
    $cookie = $matches[1][0];
    $cookie = str_replace(array('Path=/', ' ; Secure; HttpOnly', '=;'), array('', '', '=;'), $cookie);
    $imgcodeurl = makeimg($body, "code_" . $rand);
    return $imgcode = array('imgcodeurl' => $imgcodeurl, 'cookie' => $cookie);
}
Esempio n. 2
0
function wq_lurupic($cretime)
{
    include '../moni/xiaobai.php';
    $xiaobai = getmessage($token, $cookie, $cookies);
    //将用户消息转换成变
    $i = 0;
    for (; $i <= 19; $i++) {
        if ($xiaobai[$i]["date_time"] == $cretime && $xiaobai[$i]["type"] == '2') {
            break;
        }
    }
    $type = $xiaobai[$i]["type"];
    if ($i == 20) {
        return 1;
    } else {
        if ($type == 2) {
            $fakeid = $xiaobai[$i]["fakeid"];
            $nick_name = $xiaobai[$i]["nick_name"];
            $messageid = $xiaobai[$i]["id"];
            $content = $xiaobai[$i]["content"];
            //以下获取用户性别
            $details = sixi($token, $fakeid, $cookie, $cookies);
            parse_str($details);
            $sex = $gender;
            /*获取结束*/
            $img = gethead($token, $fakeid, $cookie);
            $imgurl = makeimg($img, $fakeid . '_' . $messageid);
            /*以下为获取图片*/
            $img = getimages($token, $messageid, $cookie);
            $picurl = makeimg($img, $messageid);
            //以下为写入wall
            $sql = "INSERT INTO `weixin_wall` (`id`,`messageid`,`fakeid`,`num`,`content`,`nickname`,`avatar`,`ret`,`image`,`datetime`) VALUES (NULL,'0','{$fakeid} ','-1','此消息为图片','{$nick_name}','{$imgurl}','0','{$picurl}','0')";
            mysql_query($sql);
        } else {
            return 2;
        }
    }
}
Esempio n. 3
0
 /**
  * 收到图片消息时触发,回复由收到的图片组成的图文消息
  *
  * @return void
  */
 protected function onImage()
 {
     $xuanzezu = $this->xuanzezu;
     $weixin_name = $this->weixin_name;
     $picurl = makeimg($this->getRequest('picurl'), $xuanzezu[31]);
     $this->request['picurl'] = $picurl;
     $from = $this->getRequest('fromusername');
     $time = $this->getRequest('createtime');
     $check = $this->sqlselect('flag', $from, "row");
     if (!$check[1]) {
         $reply = $this->resetflag($weixin_name, $from);
     }
     if ($check[2] == '2') {
         $reply = $this->replaypic($from, $time, $picurl);
     } else {
         global $plugsc;
         $plugs = $plugsc->find("switch=1 and status='" . $check[2] . "'");
         if (!empty($plugs)) {
             $classname = $plugs['name'] . "_plug";
             $replyc = new $classname($xuanzezu, $this->check, $this->request);
             $method = $plugs['name'] . '_replay';
             $reply = $replyc->{$method}();
         } else {
             $q = $this->sqlselect('flag', $from);
             $veryfs = $q['verify'];
             $reply = $this->VERYF($weixin_name, $veryfs);
         }
     }
     if ($xuanzezu[18] && Wechat::$noendtail) {
         $end = new NewsResponseItem('回复【退出】退出本活动系统', '');
         array_push($reply, $end);
     }
     if (Wechat::$noendtail) {
         $reply = $this->endtail($reply);
     }
     $this->responseNews($reply);
 }