當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::GetUserByUserId方法代碼示例

本文整理匯總了PHP中Model\User::GetUserByUserId方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::GetUserByUserId方法的具體用法?PHP User::GetUserByUserId怎麽用?PHP User::GetUserByUserId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Model\User的用法示例。


在下文中一共展示了User::GetUserByUserId方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Json

 public function Json()
 {
     global $user;
     $id = trim($_REQUEST['id']);
     $user = User::GetUserByUserId($user->uid);
     $node = Nodem::GetNodeById($id);
     $info = NodeUtil::NodeJson($node->server, $user->port, $user->sspwd, $node->method, $node->name);
     if (Node::CheckPlan($user->plan, $node->type)) {
         include Template::load('/node/Json');
     } else {
         throw new \Core\Error("your not vip", 233);
     }
     exit;
 }
開發者ID:gclove,項目名稱:shadowsocks-panel,代碼行數:14,代碼來源:Node.php

示例2: ChangeSSPwd

 public function ChangeSSPwd()
 {
     global $user;
     $result = array('error' => 1, 'message' => '修改失敗');
     $sspwd = trim($_GET['sspwd']);
     if ('' == $sspwd || $sspwd == null) {
         $sspwd = Util::GetRandomPwd();
     }
     $user = User::GetUserByUserId($user->uid);
     $user->sspwd = $sspwd;
     $user->updateUser();
     $result = array('error' => 1, 'message' => '修改SS連接密碼成功');
     echo json_encode($result);
     exit;
 }
開發者ID:beautifultable,項目名稱:shadowsocks-panel,代碼行數:15,代碼來源:Form.php

示例3: CheckIn

 public function CheckIn()
 {
     global $user;
     $user = User::GetUserByUserId($user->uid);
     $result = array('error' => 1, 'message' => '');
     if ($user->lastCheckinTime <= time() - 3600 * 24) {
         $checkinTransfer = rand(5, 25) * Util::GetMB();
         $user->lastCheckinTime = time();
         $user->transfer = $user->transfer + $checkinTransfer;
         $user->updateUser();
         $result['user'] = $user;
         $result['time'] = time();
         $result['message'] = '簽到成功, 獲得' . Util::FlowAutoShow($checkinTransfer) . ' 流量';
     } else {
         $result['message'] = '你已經在 ' . date('Y-m-d H:i:s', $user->lastCheckinTime) . " 時簽到過.";
     }
     echo json_encode($result);
     exit;
 }
開發者ID:haitao-wang,項目名稱:shadowsocks-panel,代碼行數:19,代碼來源:Form.php

示例4: addInvite

 public static function addInvite($uid, $plan = 'A')
 {
     $iv = $uid . substr(hash("sha256", $uid . Util::GetRandomChar(10)), 0, 26);
     $invite = new Invite();
     $invite->uid = $uid;
     $invite->dateLine = time();
     $invite->expiration = 10;
     $invite->inviteIp = Util::GetUserIP();
     $invite->invite = $iv;
     //invite code.
     $invite->reguid = 0;
     $invite->regDateLine = 0;
     $invite->plan = $plan;
     $invite->status = 0;
     $user = User::GetUserByUserId($uid);
     $user->transfer = $user->transfer - Util::GetGB() * 10;
     $user->updateUser();
     return $invite->insertToDB();
 }
開發者ID:vacan,項目名稱:shadowsocks-panel,代碼行數:19,代碼來源:Invite.php

示例5: addInvite

 public function addInvite()
 {
     global $user;
     $user = User::GetUserByUserId($user->uid);
     Invite::addInvite($user->uid, 'VIP');
     echo 'add ok';
     exit;
 }
開發者ID:bg4kks,項目名稱:shadowsocks-panel,代碼行數:8,代碼來源:Form.php

示例6: forgePwd

 /**
  * @JSON
  * @throws \Core\Error
  */
 public function forgePwd()
 {
     $result = array('error' => 1, 'message' => '請求找回密碼失敗,請刷新頁麵重試。');
     $siteName = SITE_NAME;
     if (isset($_POST['email']) && $_POST['email'] != '') {
         $user = User::getUserByEmail(htmlspecialchars(trim($_POST['email'])));
         if (!$user) {
             return $result;
         }
         if ($user->enable == 0) {
             $verify_code = json_decode($user->forgePwdCode, true)['verification'];
             if ($verify_code != null) {
                 $result['message'] = '您的賬戶還未進行郵箱校驗,請校驗完畢後再試!';
                 return $result;
             }
         }
         $user->lastFindPasswdTime = time();
         if ($user->lastFindPasswdCount != 0 && $user->lastFindPasswdCount > 2) {
             $result['message'] = '找回密碼重試次數已達上限!';
             return $result;
         }
         $code = Utils::randomChar(10);
         $forgePwdCode['code'] = $code;
         $forgePwdCode['time'] = time();
         $user->forgePwdCode = json_encode($forgePwdCode);
         $content = Option::get('custom_mail_forgePassword_content');
         $params = ['code' => $code, 'nickname' => $user->nickname, 'email' => $user->email, 'useTraffic' => Utils::flowAutoShow($user->flow_up + $user->flow_down), 'transfer' => Utils::flowAutoShow($user->transfer), 'expireTime' => date('Y-m-d H:i:s', $user->expireTime)];
         $content = Utils::placeholderReplace($content, $params);
         $mailer = Mailer::getInstance();
         $mail = new \Model\Mail();
         $mail->to = $user->email;
         $mail->subject = "[" . SITE_NAME . "] Password Recovery";
         $mail->content = $content;
         $mailer->toQueue(true);
         // 添加到郵件列隊
         $isOk = $mailer->send($mail);
         $user->save();
         $result['uid'] = $user->uid;
         if ($isOk) {
             $result['message'] = '驗證代碼已經發送到該注冊郵件地址,請注意查收!<br/>請勿關閉本頁麵,您還需要驗證碼來驗證您的賬戶所有權才可重置密碼!!';
             $result['error'] = 0;
         } else {
             $result['message'] = '郵件發送失敗, 請聯係管理員檢查郵件係統設置!';
             $result['error'] = 1;
         }
         return $result;
     } else {
         if ($_POST['code'] != '' && $_POST['uid'] != '') {
             $uid = $_POST['uid'];
             $code = trim($_POST['code']);
             $user = User::GetUserByUserId(trim($uid));
             $forgePwdCode = json_decode($user->forgePwdCode, true);
             // forgePwdCode.length > 1 且 驗證碼一樣 且 時間不超過600秒(10分鍾)
             if (count($forgePwdCode) > 1 && $forgePwdCode['code'] == $code && time() - intval($forgePwdCode['time']) < 600) {
                 $newPassword = Utils::randomChar(10);
                 $user->setPassword($newPassword);
                 $user->lastFindPasswdCount = 0;
                 $user->lastFindPasswdTime = 0;
                 $user->save();
                 $content = Option::get('custom_mail_forgePassword_content_2');
                 $params = ['code' => $code, 'newPassword' => $newPassword, 'nickname' => $user->nickname, 'email' => $user->email, 'useTraffic' => Utils::flowAutoShow($user->flow_up + $user->flow_down), 'transfer' => Utils::flowAutoShow($user->transfer), 'expireTime' => date('Y-m-d H:i:s', $user->expireTime)];
                 $content = Utils::placeholderReplace($content, $params);
                 $mailer = Mailer::getInstance();
                 $mail = new \Model\Mail();
                 $mail->to = $user->email;
                 $mail->subject = "[" . SITE_NAME . "] Your new Password";
                 $mail->content = $content;
                 $mailer->toQueue(true);
                 // 添加到郵件列隊
                 $isOk = $mailer->send($mail);
                 if ($isOk) {
                     $result['message'] = '新密碼已經發送到該賬戶郵件地址,請注意查收!<br/> 並且請在登錄後修改密碼!';
                     $result['error'] = 0;
                 } else {
                     $result['message'] = '郵件發送失敗, 請聯係管理員檢查郵件係統設置!';
                     $result['error'] = 1;
                 }
             } else {
                 $result['message'] = '驗證碼已經超時或者 驗證碼填寫不正確。請再次確認';
                 $result['error'] = -1;
             }
             return $result;
         } else {
             Template::putContext('user', User::getCurrent());
             Template::setView('panel/forgePwd');
         }
     }
     return $result;
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:93,代碼來源:Auth.php


注:本文中的Model\User::GetUserByUserId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。