/** Add user information to users table inputs: $dbh PDOConnection existing connect to the database $userInfo array Contains username, email, and password keys */ function AddToUsers($dbh, $userInfo) { //salty. in common.inc $username = $userInfo['username']; $email = $userInfo['email']; $password = hash_password($userInfo['password'], $username); $query = "INSERT INTO users(username,email,password,created) VALUES(:username, :email, :password, NOW())"; $sth = $dbh->prepare($query); $sth->bindParam(':username', $username); $sth->bindParam(':email', $email); $sth->bindParam(':password', $password); if (!$sth->execute()) { throw new Exception($sth->errorInfo()[2]); } $user_id = $dbh->lastInsertId(); verification_email($email); return $user_id; }
*/ $key = getGuid(); try { $update = "UPDATE `members` SET `key` = :key WHERE `id` = :uid LIMIT 1"; $update_do = $db->prepare($update); $update_do->bindParam(':key', $key, PDO::PARAM_STR); $update_do->bindParam(':uid', $uid, PDO::PARAM_STR); $update_do->execute(); } catch (PDOException $e) { $log->logError($e . " - " . basename(__FILE__)); } verification_email($email, $key); $err = "<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button><strong>" . _("Activation email sent.") . "</strong><br/>" . _("You will receive the activation email shortly.") . "</div>"; am_showResend(); } else { verification_email($email, $key); $err = "<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button><strong>" . _("Activation email sent.") . "</strong><br/>" . _("You will receive the activation email shortly.") . "</div>"; am_showResend(); } } else { $err = "<div class=\"alert\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button><strong>" . _("Account Active.") . "</strong><br/>" . _("You already have an active account with us. There is no need for activation.") . "</div>"; am_showResend(); } } else { $err = "<div class=\"alert alert-error\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button><strong>" . _("Email not found.") . "</strong><br/>" . _("It seems that this email is not registered with us.") . "</div>"; am_showResend(); } } else { $err = "<div class=\"alert alert-error\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button><strong>" . _("Invalid Verification.") . "</strong><br/>" . _("Please fill in the verification field correctly.") . "</div>"; am_showResend(); }