本文整理汇总了PHP中UserRepository::LoadWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::LoadWhere方法的具体用法?PHP UserRepository::LoadWhere怎么用?PHP UserRepository::LoadWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRepository
的用法示例。
在下文中一共展示了UserRepository::LoadWhere方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ChangePassword
public static function ChangePassword($oldPassword, $newPassword)
{
$userRepository = new UserRepository();
$user = $userRepository->LoadWhere("Id = " . self::$userId)[0];
if ($user["Password"] == self::Encode($oldPassword)) {
$userRepository->UpdateWhere("Id = " . self::$userId, ["Password" => self::Encode($newPassword)]);
return true;
} else {
return false;
}
}
示例2: Map
public function Map()
{
$this->Route('POST', '/login', function () {
$request = $this->GetRequestData();
if (isset($request->username) && isset($request->password)) {
$authCallback = AuthRepository::Login($request->username, $request->password);
if ($authCallback != false) {
$this->Send($authCallback);
} else {
$this->Unauthorized();
}
} else {
$this->NotFound();
}
});
$this->Route('POST', '/changepassword', function () {
$request = $this->GetRequestData();
if (isset($request->oldPassword) && isset($request->newPassword)) {
if (AuthRepository::Autherize()) {
$this->Send(["Status" => AuthRepository::ChangePassword($request->oldPassword, $request->newPassword)]);
}
} else {
$this->NotFound();
}
});
$this->Route('GET', '/[i:id]/profilepicture', function ($id) {
$userRepository = new UserRepository();
$user = $userRepository->LoadWhere("Id = {$id}")[0];
$img = imagecreatefromjpeg("images/profilepictures/" . $user["Profilepicture"]);
$imageRepository = new ImageRepository();
$imageRepository->CacheImage("images/profilepictures/" . $user["Profilepicture"]);
header("Content-Type: image/jpg");
imagejpeg($img);
imagedestroy($img);
exit;
});
}