當前位置: 首頁>>代碼示例>>PHP>>正文


PHP misc::send_mail方法代碼示例

本文整理匯總了PHP中misc::send_mail方法的典型用法代碼示例。如果您正苦於以下問題:PHP misc::send_mail方法的具體用法?PHP misc::send_mail怎麽用?PHP misc::send_mail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在misc的用法示例。


在下文中一共展示了misc::send_mail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: header

    header("Pragma: cache");
    require "includes/header.php";
}
if (isset($_POST['username']) && $_POST['username'] != "") {
    $user = $db->real_escape_string(htmlentities($_POST['username'], ENT_QUOTES, 'UTF-8'));
    $query = "SELECT email, id FROM {$user_table} WHERE user='{$user}' LIMIT 1";
    $result = $db->query($query);
    $count = $result->num_rows();
    if ($count > 0) {
        $row = $result->fetch_assoc();
        if ($row['email'] != "" && $row['email'] != NULL && strpos($row['email'], "@") !== false && strpos($row['email'], ".") !== false && strlen($row['email']) > 2) {
            $misc = new misc();
            $code = hash('sha256', rand(132, 1.0049583277478826E+21));
            $link = $site_url . "/index.php?page=reset_password&code=" . $code . "&id=" . $row['id'];
            $body = 'A password reset has been requested for your account.<br /><br /> If you didn\'t request this, please ignore this email.<br /><br />To reset you password, please click on this link: <a href="' . $link . '">' . $link . '</a>';
            $misc->send_mail($row['email'], $email_recovery_subject, $body);
            $query = "UPDATE {$user_table} SET mail_reset_code='{$code}' WHERE id='" . $row['id'] . "'";
            $db->query($query);
            print "An email with a reset link has been sent to your mailbox.<br />";
        } else {
            print "No email has been added to this account.<br />";
        }
    } else {
        print "No email has been added to this account.<br />";
    }
}
if (isset($_GET['code']) && $_GET['code'] != "" && isset($_GET['id']) && $_GET['id'] != "" && is_numeric($_GET['id'])) {
    $id = $db->real_escape_string($_GET['id']);
    $code = $db->real_escape_string($_GET['code']);
    $query = "SELECT id FROM {$user_table} WHERE id='{$id}' AND mail_reset_code='{$code}' LIMIT 1";
    $result = $db->query($query) or die($db->error);
開發者ID:logtcn,項目名稱:gelbooru-fork,代碼行數:31,代碼來源:reset_password.php


注:本文中的misc::send_mail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。