示例#1
0
/**
 * Sends the activation email for the user and updates the activation_code.
 * @author Raafat
 * @param  integer $user_id The unique ID of the user.
 * @return boolean True if the email was sent and false otherwise.
 */
function accountActivation($user_id)
{
    $user = getFullUserById($user_id);
    return sendActivationMail($user["email"], $user_id, updateCode($user_id));
}
示例#2
0
文件: profile.php 项目: rw00/tutorme
    </div>

    <div id="content">
        <div id="main-content">
            <?php 
$user_id = $_SESSION["user_id"];
if (isset($_POST["current_password"])) {
    if (isset($_POST["first_name"], $_POST["last_name"], $_POST["email"], $_POST["current_password"], $_POST["phone_number"], $_POST["address"], $_POST["password"], $_POST["confirm_password"])) {
        $update = updateProfile($user_id, $_POST);
        $update === true ? $update = UPDATE_PROFILE_SUCCESS : ($update = $update);
        # $update = ($update === true) ? UPDATE_PROFILE_SUCCESS : $update;
        $_SESSION["notice"] = $update;
        displayNotice();
    }
}
$u = getFullUserById($user_id);
$type = getUserTypeById($user_id);
?>
            <h4> Profile Information </h4>
            <form action="profile" id="profile-form" class="form-horizontal" method="post">
                <div class="form-group">
                    <label class="control-label col-sm-3">Account Type: </label>
                    <div class="col-sm-4" style="margin-top: 9px;">
                        <?php 
if ($type === "Student") {
    echo "Student";
} else {
    if ($type === "Tutor") {
        echo "Tutor";
    } else {
        redirectOut();
示例#3
0
# requested password reset...
if (isset($_POST["user_email"])) {
    $email = $_POST["user_email"];
    if (userExists($email) === true) {
        $user_id = getUserIdByEmail($email);
        sendResetMail($email, $user_id, updateCode($user_id));
        echo "<p> An email with instructions to reset your password was sent to your inbox. </p>";
    } else {
        echo $false_info;
    }
} else {
    if (isset($_GET["id"], $_GET["code"])) {
        # checking reset password link...
        $id = $_GET["id"];
        $code = $_GET["code"];
        $u = getFullUserById($id);
        $valid = true;
        if ($u === null) {
            echo $false_info;
            $valid = false;
        }
        if ($code !== $u["activation_code"]) {
            echo $FALSE_INFO_ERR;
        } else {
            if ($valid) {
                require_once "/views/change_password_form.html";
            }
        }
    } else {
        if (isset($_POST["password"], $_POST["confirm_password"], $_POST["id"])) {
            # resetting password...