Hendrik post #126

Merged
11342374 merged 53 commits from hendrik-post into master 2017-01-25 16:20:49 +01:00
2 changed files with 10 additions and 7 deletions
Showing only changes of commit 827be40646 - Show all commits

View File

@@ -25,7 +25,9 @@ function sendConfirmEmail(int $userID) {
WHERE
`userID` = :userID
");
$stmt->bindParam(":userID", $userID);
$stmt->execute();
$user = $stmt->fetch();
$email = $user["email"];
@@ -34,10 +36,7 @@ function sendConfirmEmail(int $userID) {
$confirmLink = "https://myhyvesbookplus.nl/emailconfirm.php?u=$userID&h=$hash";
$subject = "Bevestig uw emailadres";
$body = "Hallo $fname,\r\n\r\n
Klik op de onderstaande link om uw emailadres te bevestigen.\r\n\r\n
$confirmLink\r\n\r\n
Groeten MyHyvesbook+";
$body = "Hallo $fname,\r\n\r\nKlik op de onderstaande link om uw emailadres te bevestigen.\r\n\r\n$confirmLink\r\n\r\nGroeten MyHyvesbook+";
$header = "From: MyHyvesbook+ <noreply@myhyvesbookplus.nl>";
mail($email, $subject, $body, $header);
}

View File

@@ -1,4 +1,6 @@
<?php
include_once "../queries/emailconfirm.php";
abstract class AlertMessage extends Exception {
public function __construct($message = "", $code = 0, Exception $previous = null)
{
@@ -168,16 +170,18 @@ function doChangeEmail($email) {
UPDATE
`user`
SET
`email` = :email
`email` = :email,
`role` = 'unconfirmed'
WHERE
`userID` = :userID
");
$stmt->bindParam(":email", $email);
$stmt->bindParam(":userID", $_SESSION["userID"]);
$stmt->execute();
// return $stmt->rowCount();
if ($stmt->rowCount()) {
sendConfirmEmail($_SESSION["userID"]);
session_destroy();
throw new HappyAlert("Emailadres is veranderd.");
} else {
throw new AngryAlert();