예제 #1
0
 function webwxsync()
 {
     $user = Login::where('wxuin', $this->wxuin)->where('status', 1)->first();
     if (!$user) {
         $this->death('读取消息失败,wxuin已被冻结');
     }
     $cookies = json_decode($user->cookies);
     $url = "https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsync?sid=" . urlencode($cookies->wxsid) . "&skey=" . urlencode($user->skey) . "&lang=zh_CN" . "&pass_ticket=" . urlencode($user->pass_ticket);
     $post = '{"BaseRequest":{"Uin":' . $user->Uin . ',"Sid":"' . $cookies->wxsid . '","Skey":"' . $user->skey . '","DeviceID":"' . $user->deviceid . '"},"SyncKey":' . $user->SyncKey . ',"rr":-' . rr() . '}';
     $ret = CURL::send($url, ['Cookie' => urldecode(http_build_query($cookies, '', '; '))], ['follow_redirects' => false], ['ret' => 'all', 'post' => $post]);
     $html = $ret->body;
     $cookies2 = toCookies($ret->cookies);
     $cookies = (object) ((array) $cookies2 + (array) $cookies);
     //更新Cookie
     Login::where('wxuin', $this->wxuin)->update(['cookies' => json_encode($cookies)]);
     $data_arr = $this->post_check($html);
     //判断数据包是否正常
     \Log::info('接收到消息:', $data_arr);
     //读取消息
     if ($data_arr['AddMsgCount'] > 0) {
         foreach ($data_arr['AddMsgList'] as $k => $v) {
             echo json_encode($v) . "\r\n";
             if ($v['MsgType'] == 51 || $v['Content'] == "") {
                 //51好像没什么用,可能是正在输入的意思
                 continue;
             }
             $msg = Msglist::where('MsgId', $v['MsgId'])->first();
             if ($msg) {
                 continue;
                 //如果存在就抛弃
             }
             $data['MsgId'] = $v['MsgId'];
             $data['FromUserName'] = $v['FromUserName'];
             $data['ToUserName'] = $v['ToUserName'];
             $data['MsgType'] = $v['MsgType'];
             $data['Content'] = $v['Content'];
             $data['Status'] = $v['Status'];
             $data['ImgStatus'] = $v['ImgStatus'];
             $data['CreateTime'] = $v['CreateTime'];
             $data['time_y'] = date('Y', $v['CreateTime']);
             $data['time_m'] = date('m', $v['CreateTime']);
             $data['time_d'] = date('d', $v['CreateTime']);
             $data['time_h'] = date('H', $v['CreateTime']);
             $data['my_uin'] = $this->wxuin;
             Msglist::insert($data);
             //加入消息处理队列    在本框架内出错,无法调用
             $msg = new LoginController();
             $msg->MsgDeal($this->wxuin, $v['MsgId']);
         }
     }
     //处理SyncKey
     if ($data_arr['SyncKey']['Count'] > 0) {
         $l['SyncKey'] = json_encode($data_arr['SyncKey']);
         Login::where('wxuin', $this->wxuin)->update($l);
     }
     //处理SKey
     if ($data_arr['SKey'] != "") {
         Login::where('wxuin', $this->wxuin)->update('skey', $data_arr['SKey']);
     }
 }
예제 #2
0
 public function getLoginOk($wxuin)
 {
     $file = "user/{$wxuin}.txt";
     if (\Storage::exists($file)) {
         $user = \Storage::get($file);
         $user = json_decode($user);
     } else {
         return '不存在此wxuin';
     }
     //进行post登陆尝试
     $url = "https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit?lang=zh_CN&pass_ticket=" . urlencode($user->pass_ticket) . "&r=-" . rr();
     $post = '{"BaseRequest":{"Uin":"' . $user->cookies->wxuin . '","Sid":"' . $user->cookies->wxsid . '","Skey":"' . $user->skey . '","DeviceID":"' . $user->deviceid . '"}}';
     $ret = CURL::send($url, ['Cookie' => urldecode(http_build_query($user->cookies, '', '; '))], ['follow_redirects' => false], ['ret' => 'all', 'post' => $post]);
     $cookies = toCookies($ret->cookies);
     $cookies = (object) ((array) $cookies + (array) $user->cookies);
     //判断是否正常
     $data_arr = json_decode($ret->body, true);
     if (count($data_arr)) {
         if (!isset($data_arr['BaseResponse']['Ret'])) {
             $data_arr = array();
         } else {
             if ($data_arr['BaseResponse']['Ret'] != 0) {
                 return $data_arr['BaseResponse']['Ret'] . $data_arr['BaseResponse']['ErrMsg'] . ',请从新<a href="/login/">扫描</a>';
             }
         }
     } else {
         return '没有获取到内容,请从新<a href="/login/">扫描</a>';
     }
     //开始获取基本信息了
     $data['Uin'] = $data_arr['User']['Uin'];
     $data['UserName'] = $data_arr['User']['UserName'];
     $data['NickName'] = $data_arr['User']['NickName'];
     $data['SyncKey'] = json_encode($data_arr['SyncKey']);
     $data['wxuin'] = $cookies->wxuin;
     $data['skey'] = urldecode($user->skey);
     $data['pass_ticket'] = urldecode($user->pass_ticket);
     $data['deviceid'] = $user->deviceid;
     $data['cookies'] = json_encode($cookies);
     //设置状态为可用
     $data['status'] = 1;
     Login::inSave($data);
     //删除临时文件
     \Storage::delete($file);
     //写入好友信息
     $this->ContactList($data_arr);
     //加入群信息获取队列
     $job = (new JobChatroom($data['wxuin']))->onQueue('chatroom');
     $this->dispatch($job);
     //加入监控队列
     $job = (new JobCheck($data['wxuin']))->onQueue('check');
     $this->dispatch($job);
 }
예제 #3
0
<form action="sign.php" method="POST">
Username:<input type="text" name="pname"/>
Password:<input type="password" name="ppass"/>
<input type="submit" value="log in"/>
</form>

<?php 
function rr()
{
    echo date("d-m-y");
}
if (isset($_POST["pname"]) && isset($_POST["ppass"]) && !empty($_POST["pname"]) && !empty($_POST["ppass"])) {
    echo rr();
} else {
    echo "Please Put your username and password";
}
예제 #4
0
            $rs = mysql_fetch_array($rsObj);
            $GLOBALS['cfg_webSiteUrl'] = $rs['websiteurl'] . '';
            //网址
            $GLOBALS['cfg_webTitle'] = $rs['webtitle'] . '';
            //网址标题
            $GLOBALS['cfg_flags'] = $rs['flags'] . '';
            //旗
            $GLOBALS['cfg_webtemplate'] = $rs['webtemplate'] . '';
            //模板路径
        }
    }
}
//登录判断
if (@$_SESSION['adminusername'] == '') {
    if (@$_REQUEST['act'] != '' && @$_REQUEST['act'] != 'displayAdminLogin' && @$_REQUEST['act'] != 'login') {
        rr('?act=displayAdminLogin');
    }
}
//显示后台登录
function displayAdminLogin()
{
    //已经登录则直接进入后台
    if (@$_SESSION['adminusername'] != '') {
        adminIndex();
    } else {
        $c = '';
        $c = getTemplateContent('login.html');
        $c = handleDisplayLanguage($c, 'login');
        Rw($c);
    }
}
예제 #5
0
echo "\n ---- Pass by ref / pass by val: functions ----\n";
unset($u1, $u2);
v($u1);
r($u2);
var_dump($u1, $u2);
unset($u1, $u2);
vv($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
vr($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
rv($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
rr($u1, $u2);
var_dump($u1, $u2);
echo "\n\n ---- Pass by ref / pass by val: static method calls ----\n";
unset($u1, $u2);
C::v($u1);
C::r($u2);
var_dump($u1, $u2);
unset($u1, $u2);
C::vv($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
C::vr($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
C::rv($u1, $u2);
var_dump($u1, $u2);