Example #1
0
<?php

// $Id: sendPass.php 23863 2015-09-14 00:27:14Z 1070356 $
require_once 'functions.php';
if (isset($_POST['id'])) {
    $id = $_POST['id'];
    $result = sql("SELECT mail, name FROM users WHERE id={$id}");
    if ($result->num_rows) {
        $row = $result->fetch_row();
        $pass = sendPass($row[0], $row[1]);
        // 비밀번호를 만들어 메일로 보낸다
        if ($pass) {
            $pass = escapeString(getHash($pass));
            sql("UPDATE users SET pass='******' WHERE id = {$id}");
            echo affectedRows();
            // 반환 값이 1이면 정상이다
        }
    }
    $result->close();
}
Example #2
0
    $stmnt2->bind_param('s', $userId);
    $stmnt2->execute();
    $stmnt2->store_result();
    $amount = $stmnt2->num_rows;
    if ($amount == 0) {
        echo "user does not exists ";
        return false;
    }
    $stmnt2->close();
    $stmnt = $conn->prepare("SELECT USER_EMAIL FROM USERS2 WHERE USER_UID = ?;");
    $stmnt->bind_param('s', $userId);
    $stmnt->execute();
    $stmnt->bind_result($email);
    $stmnt->fetch();
    $subject = "Change Password From Who R U";
    $message = "fill out the form at this link to create a new passord for your account\n141.210.25.46/changepass.php?USERNAME={$userId}";
    $from = "-f your@email.here";
    if (mail($email, $subject, $message)) {
        $stmnt->close();
        return true;
    } else {
        echo "unable to send mail ";
        $stmnt->close();
        return false;
    }
}
if (sendPass($_POST["USERNAME"])) {
    echo "True";
} else {
    echo "False";
}