本文整理匯總了PHP中models\User::getEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getEmail方法的具體用法?PHP User::getEmail怎麽用?PHP User::getEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\User
的用法示例。
在下文中一共展示了User::getEmail方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
示例2: 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
}
}
示例3: getEmail
public function getEmail()
{
$this->_load();
return parent::getEmail();
}
示例4: create
public function create()
{
if ($_POST['regPassword'] != $_POST['regPassword2']) {
$this->addPopup('danger', 'Hesla se neshodují.');
redirectTo("/registrace");
}
if (!User::checkRegistrationValidity()) {
redirectTo("/registrace");
}
$existing = User::checkExistingUsernameEmail();
if ($existing != NULL) {
if ($existing->getUsername() == $_POST["regUsername"]) {
$this->addPopup('danger', 'Uživatel se stejným uživatelským jménem je již zaregistrován.');
} elseif ($existing->getEmail() == $_POST["regEmail"]) {
$this->addPopup('danger', 'Uživatel se stejnou emailovou adresou je již zaregistrován.');
}
redirectTo("/registrace");
} else {
$token = token(50);
$user = new User();
$user->setIdImage(6);
$user->setUsername(strip_tags($_POST['regUsername']));
$user->setPassword(strip_tags(sha1($_POST['regPassword'])));
$user->setEmail(strip_tags($_POST['regEmail']));
$user->setUrl(strip_tags($_POST['regUsername']));
$user->setEmailConfirmToken($token);
$user->setPasswordResetToken(NULL);
$user->setPermissions(0);
$user->setSigninCount(0);
sendEmailConfirmationToken($user->getUsername(), $user->getEmailConfirmToken(), $user->getEmail());
$user->save();
$this->addPopup('success', 'Registrace proběhla úspěšně! Nyní se můžete přihlásit.');
redirectTo("/");
}
}
示例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: __construct
public function __construct(\Models\User $user)
{
$this->username = $user->getUsername();
$this->pwd = $user->getPwd();
$this->email = $user->getEmail();
}
示例7: create
protected function create()
{
if (isset($_POST["email"]) && isset($_POST["username"]) && isset($_POST["password"])) {
$user = new User();
$emailConfirmToken = uniqid() . generateRandomString(19);
$user->fromArray(array("Email" => $_POST["email"], "Username" => $_POST["username"], "Password" => $_POST["password"], "EmailConfirmToken" => $emailConfirmToken));
if (!$user->save()) {
$failures = $user->getValidationFailures();
if (count($failures) > 0) {
foreach ($failures as $failure) {
$this->sendFlashMessage("You have not been signed up. " . $failure->getMessage(), "error");
}
}
} else {
$this->sendFlashMessage('You have been successfuly signed up. Please confirm your email address, we have send confirmation link. <a class="link" href="/user/' . $user->getUsername() . '/send-email-confirm-email">Send new email confirm link?</a>', "success");
$body = '<p>You have created new account on Starling.</p><br /><p>Please virify your email address by clicking this url:</p><a href="' . $this->siteURL . '/user/' . $user->getUsername() . '/email-confirm/' . urlencode($emailConfirmToken) . '">' . $this->siteURL . '/user/' . $user->getUsername() . '/email-confirm/' . urlencode($emailConfirmToken) . '</a>';
$transport = \Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')->setUsername($this->emailAddress)->setPassword($this->emailPassword);
$mailer = \Swift_Mailer::newInstance($transport);
$message = \Swift_Message::newInstance()->setSubject('Email verification')->setFrom(array($this->emailAddress => 'Starling admin'))->setTo(array($user->getEmail() => $user->getUsername()))->setBody($body, 'text/html');
$result = $mailer->send($message);
}
$this->redirect("/");
} else {
setHTTPStatusCode("400");
}
}
示例8: 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());
}