$OauthObject->GetUserInfo(); CheckOpenID(); } if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!ReferCheck(Request('Post', 'FormHash')) || empty($_SESSION[$Prefix . 'OauthAccessToken']) || !$State || empty($_SESSION[$Prefix . 'OauthState']) || $State != $_SESSION[$Prefix . 'OauthState']) { AlertMsg($Lang['Error_Unknown_Referer'], $Lang['Error_Unknown_Referer'], 403); } // 读入Access Token $OauthObject->AccessToken = $_SESSION[$Prefix . 'OauthAccessToken']; // 释放session防止阻塞 session_write_close(); if (!$OauthObject->GetOpenID()) { AlertMsg('400 Bad Request', '400 Bad Request', 400); } $OauthUserInfo = $OauthObject->GetUserInfo(); CheckOpenID(); $UserName = strtolower(Request('Post', 'UserName')); if ($UserName && IsName($UserName)) { $UserExist = $DB->single("SELECT ID FROM " . $Prefix . "users WHERE UserName = :UserName", array('UserName' => $UserName)); if (!$UserExist) { $NewUserSalt = mt_rand(100000, 999999); $NewUserPassword = '******' . substr(md5(md5(mt_rand(1000000000, 2147483647)) . $NewUserSalt), 0, -3); $NewUserData = array('ID' => null, 'UserName' => $UserName, 'Salt' => $NewUserSalt, 'Password' => $NewUserPassword, 'UserMail' => '', 'UserHomepage' => '', 'PasswordQuestion' => '', 'PasswordAnswer' => '', 'UserSex' => 0, 'NumFavUsers' => 0, 'NumFavTags' => 0, 'NumFavTopics' => 0, 'NewMessage' => 0, 'Topics' => 0, 'Replies' => 0, 'Followers' => 0, 'DelTopic' => 0, 'GoodTopic' => 0, 'UserPhoto' => '', 'UserMobile' => '', 'UserLastIP' => $CurIP, 'UserRegTime' => $TimeStamp, 'LastLoginTime' => $TimeStamp, 'LastPostTime' => $TimeStamp, 'BlackLists' => '', 'UserFriend' => '', 'UserInfo' => '', 'UserIntro' => '', 'UserIM' => '', 'UserRoleID' => 1, 'UserAccountStatus' => 1, 'Birthday' => date("Y-m-d", $TimeStamp)); $DB->query('INSERT INTO `' . $Prefix . 'users` (`ID`, `UserName`, `Salt`, `Password`, `UserMail`, `UserHomepage`, `PasswordQuestion`, `PasswordAnswer`, `UserSex`, `NumFavUsers`, `NumFavTags`, `NumFavTopics`, `NewMessage`, `Topics`, `Replies`, `Followers`, `DelTopic`, `GoodTopic`, `UserPhoto`, `UserMobile`, `UserLastIP`, `UserRegTime`, `LastLoginTime`, `LastPostTime`, `BlackLists`, `UserFriend`, `UserInfo`, `UserIntro`, `UserIM`, `UserRoleID`, `UserAccountStatus`, `Birthday`) VALUES (:ID, :UserName, :Salt, :Password, :UserMail, :UserHomepage, :PasswordQuestion, :PasswordAnswer, :UserSex, :NumFavUsers, :NumFavTags, :NumFavTopics, :NewMessage, :Topics, :Replies, :Followers, :DelTopic, :GoodTopic, :UserPhoto, :UserMobile, :UserLastIP, :UserRegTime, :LastLoginTime, :LastPostTime, :BlackLists, :UserFriend, :UserInfo, :UserIntro, :UserIM, :UserRoleID, :UserAccountStatus, :Birthday)', $NewUserData); $CurUserID = $DB->lastInsertId(); //Insert App user $DB->query('INSERT INTO `' . $Prefix . 'app_users` (`ID`, `AppID`, `OpenID`, `AppUserName`, `UserID`, `Time`) VALUES (:ID, :AppID, :OpenID, :AppUserName, :UserID, :Time)', array('ID' => null, 'AppID' => $AppID, 'OpenID' => $OauthObject->OpenID, 'AppUserName' => htmlspecialchars($OauthObject->NickName), 'UserID' => $CurUserID, 'Time' => $TimeStamp));
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號098 綁定手機號 ##參考015和096 // // @authors hjboss <*****@*****.**> 2015-12-18# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } if (CheckOpenID($params['openid'], $params['uid']) == FALSE) { $result['msg'] = '电话号码已注册!'; } else { $fields = array('username_d' => Assign($params[KEY_PHONE]), 'password' => Assign($params['pwd'])); $num = StorageEditByID('hh_techuser', $fields, $params['uid']); if ($num <= 0) { $result['msg'] = '绑定失败!'; } else { $result = array('code' => '101', 'msg' => '绑定成功!'); } }
## 統計查詢總數 $count = StorageRows($condition); ## 截獲最新20條數據 $condition['others'] .= ' LIMIT 20'; $recordset = StorageFind($condition); if (is_array($recordset) and empty($recordset) == FALSE) { $result = array('code' => '101', 'data' => array()); $item = array('total' => $count, 'list' => array(), 'keys' => array()); foreach ($recordset as $index => $row) { $item['list'][] = array('id' => $row['id'], 'title' => fmtstr($row['title']), 'lable' => fmtstr($row['lable']), 'miaoshu' => fmtstr($row['miaoshu'])); } $condition_buf = array('schema' => 'car_word', 'filter' => array('id' => array('IN', $word_id))); $buf = StorageFind($condition_buf); if (is_array($buf) and empty($buf) == FALSE) { foreach ($buf as $row) { $item['keys'][] = $row['keyword']; for ($index = 1; $index <= 9; $index++) { if (empty($row['keyword' . $index]) == FALSE) { $item['keys'][] = $row['keyword' . $index]; } } } } $result['data'][] = $item; ## 積累積分 if (CheckOpenID($params['openid'], $params['uid']) == TRUE) { if (empty($params['uid']) == FALSE) { Techuser_setScore(Assign($params['uid'], 0), 2); } } }