当前位置: 首页>>代码示例>>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;未经允许,请勿转载。