本文整理匯總了PHP中models\User::getPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getPassword方法的具體用法?PHP User::getPassword怎麽用?PHP User::getPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\User
的用法示例。
在下文中一共展示了User::getPassword方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: logintry
public function logintry($postdata)
{
$inputname = $postdata['inputname'];
$inputpass = $postdata['inputpass'];
$user = new User();
$user->findByName($inputname);
if ($user->getPassword() === hash('sha256', $inputpass)) {
Session::create('user', $user->getName());
} else {
echo 0;
}
}
示例2: save
public function save(User $user)
{
$query = "SELECT * FROM users WHERE username = ?";
$this->db->query($query, [$user->getUsername()]);
$result = $this->db->row();
if ($result) {
echo 'The username already taken!';
die;
}
$query = "\n INSERT INTO users (username, email, cash, roleId, password)\n VALUES (?, ?, ?, ?, ?)\n ";
$params = [$user->getUsername(), $user->getEmail(), floatval($user->getCash()), $user->getRole(), $user->getPassword()];
if ($user->getId()) {
$query = "UPDATE players SET username = ?, password = ? WHERE id = ?";
$params[] = $user->getId();
}
$this->db->query($query, $params);
return $this->db->rows() > 0;
}
示例3: registerUser
public static function registerUser(User $user)
{
$db = Database::getInstance();
$query = $db->prepare('INSERT INTO users (firstname, lastname, username, password, email) VALUES (?, ?, ?, ?, ?)');
$query->execute([$user->getFirstName(), $user->getLastName(), $user->getUsername(), $user->getPassword(), $user->getEmail()]);
$affected = $query->rowCount();
if ($affected == 1) {
redirect(\route\Route::get("index")->generate());
} else {
?>
<script>
document.getElementById("failedRegister").innerHTML =
"User already exists.";
</script>
<?php
}
}
示例4: getPassword
public function getPassword()
{
$this->_load();
return parent::getPassword();
}
示例5: insert
private static function insert(User $model)
{
$db = Database::getInstance('app');
$query = "INSERT INTO users (username,email,password,role_id,f_name,l_name,gender,date_of_birth,registered_at) VALUES (:username, :email, :password, :role_id, :f_name, :l_name, :gender, :date_of_birth, :registered_at);";
$result = $db->prepare($query);
$result->execute([':username' => $model->getUsername(), ':email' => $model->getEmail(), ':password' => $model->getPassword(), ':role_id' => $model->getRole_id(), ':f_name' => $model->getF_name(), ':l_name' => $model->getL_name(), ':gender' => $model->getGender(), ':date_of_birth' => $model->getDate_of_birth(), ':registered_at' => $model->getRegistered_at()]);
$model->setId($db->lastId());
}
示例6: insert
private static function insert(User $model)
{
$db = Database::getInstance('app');
$query = "INSERT INTO user (username,password,registerDate,emailVerified,email,createdAt,updatedAt) VALUES (:username, :password, :registerDate, :emailVerified, :email, :createdAt, :updatedAt);";
$result = $db->prepare($query);
$result->execute([':username' => $model->getUsername(), ':password' => $model->getPassword(), ':registerDate' => $model->getRegisterDate(), ':emailVerified' => $model->getEmailVerified(), ':email' => $model->getEmail(), ':createdAt' => $model->getCreatedAt(), ':updatedAt' => $model->getUpdatedAt()]);
$model->setId($db->lastId());
}