本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
示例5: addInvite
public function addInvite()
{
global $user;
$user = User::GetUserByUserId($user->uid);
Invite::addInvite($user->uid, 'VIP');
echo 'add ok';
exit;
}
示例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;
}