function getDataToReport($operateType, $datatosync, $datas) { $datatoreport = array(); foreach ($datatosync as $operateresult => $ids) { foreach ($ids as $id) { if (!$datas[$id]['isreported']) { $data = array('operateType' => $operateType, 'operate' => $operateresult == 'validate' ? 'restore' : 'delete', 'operateId' => $id, 'uid' => $datas[$id]['authorid'] ? $datas[$id]['authorid'] : $datas[$id]['uid']); $data['openId'] = getOpenId($data['uid']); $data['clientIp'] = $datas[$id]['userip'] ? $datas[$id]['userip'] : getMemberIp($data['uid']); if ($operateType != 'member') { $data['tid'] = $datas[$id]['tid']; $data['pid'] = $datas[$id]['pid']; $data['fid'] = $datas[$id]['fid']; } array_push($datatoreport, $data); } } } return $datatoreport; }
public function index() { echo $openid = getOpenId(); print_r(session()); }
public function test() { $card = getOpenId(); print_r($card); }
function getOperateData($type, $limit = 20) { if (notOpenService()) { return false; } $allowType = array('post', 'user', 'member'); $operateData = array(); $operateResultData = array(); if ($type == 'member') { $type = 'user'; } if (!in_array($type, $allowType)) { return false; } $tableName = DB::table('security_evil' . $type); $query = "SELECT * FROM " . $tableName . " WHERE isreported = 0 AND operateresult > 0 LIMIT {$limit}"; $query = DB::query($query); while ($tempData = DB::fetch($query)) { $operateData[] = $tempData; } foreach ($operateData as $tempData) { $operateResult = $tempData['operateresult'] == 1 ? 'recover' : 'delete'; if ($type == 'post') { require_once libfile('function/forum'); $detailData = get_post_by_pid($tempData['pid']); $id = $tempData['pid']; } elseif ($type == 'user') { $detailData = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid = '{$tempData['uid']}'"); $id = $tempData['uid']; } if ($type == 'post') { $operateType = $detailData['first'] ? 'thread' : 'post'; } elseif ($type == 'user') { $operateType = 'member'; } $data = array('tid' => $detailData['tid'] ? $detailData['tid'] : 0, 'pid' => $detailData['pid'] ? $detailData['pid'] : 0, 'fid' => $detailData['fid'] ? $detailData['fid'] : 0, 'operateType' => $operateType, 'operate' => $operateResult, 'operateId' => $id, 'uid' => $detailData['authorid'] ? $detailData['authorid'] : $detailData['uid']); $data['openId'] = getOpenId($data['uid']); $data['clientIp'] = $detailData['useip'] ? $detailData['useip'] : getMemberIp($data['uid']); $operateResultData[] = $data; } return $operateResultData; }
<body> <?php header("Content-Type: text/html; charset=utf-8"); require_once "./common/config.inc.php"; require_once "./common/https_get_contents.php"; require_once "./oauth/getAccessToken.php"; require_once "./oauth/getOpenId.php"; require_once "./api/getUserInfo.php"; if (isset($_GET['code'])) { $code = $_GET['code']; $accessToken = getAccessToken($code); $result = array(); parse_str($accessToken, $result); $accessToken = $result["access_token"]; $expiresIn = $result["expires_in"]; $temp = getOpenId($accessToken); $temp = str_replace("callback(", "", $temp); $temp = str_replace(");", "", $temp); $rst = json_decode($temp); $openId = $rst->openid; $appId = $rst->client_id; $url = "success.php?access_token={$accessToken}&appid={$appId}&openid={$openId}"; header("Location:{$url}"); } if (isset($_GET["access_token"]) && isset($_GET["appid"]) && isset($_GET["openid"])) { $accessToken = $_GET["access_token"]; $appid = $_GET["appid"]; $openid = $_GET["openid"]; $ret = getUserInfo($accessToken, $appid, $openid); $ret = json_decode($ret); echo "openid:" . $openId . "<br/>";