当前位置: 首页>>代码示例>>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;未经允许,请勿转载。