Skip to content

Commit

Permalink
Updated Email Confirmation System
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaiahJTurner committed Jun 22, 2014
1 parent e251ba5 commit a2e69c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions confirm.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php
require_once("functions.php");
$whack = new Whack();
$whack->confirmUser($_GET['user'], $_GET['code']);
echo("worked");
$success = $whack->confirmUser($_GET['user'], $_GET['code']);
if (!$success) {
die("Invalid confirmation code.");
}
header("Location: /account");
die("Your email has been confirmed. You may now visit your account.");
3 changes: 2 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ function confirmUser($user,$code) {
if (sha1($user.EMAIL_CONFIRMATION_KEY) != $code) return false;
$mysqli = mysqli_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_NAME) or die("Error " . mysqli_error($mysqli));
$user = intval($user);
$query = "UPDATE `users` SET `confirmed` = '1' WHERE `user` = '$user'";
$query = "UPDATE `users` SET `confirmed` = '1' WHERE `id` = '$user'";
mysqli_query($mysqli, $query);
return true;
}
// Creates a new user.
function register($username, $email, $password) {
Expand Down

0 comments on commit a2e69c0

Please sign in to comment.