当前位置: 首页>>代码示例>>PHP>>正文


PHP mail::B64Header方法代码示例

本文整理汇总了PHP中mail::B64Header方法的典型用法代码示例。如果您正苦于以下问题:PHP mail::B64Header方法的具体用法?PHP mail::B64Header怎么用?PHP mail::B64Header使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mail的用法示例。


在下文中一共展示了mail::B64Header方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: trim

    $user_id = @unpack('a32', @pack('H*', $user_id));
    if (is_array($user_id)) {
        $user_id = trim($user_id[1]);
        $user_key = substr($_COOKIE['dc_admin'], 0, 40);
        $user_pwd = null;
    } else {
        $user_id = null;
    }
}
# Recover password
if ($recover && !empty($_POST['user_id']) && !empty($_POST['user_email'])) {
    $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
    $user_email = !empty($_POST['user_email']) ? $_POST['user_email'] : '';
    try {
        $recover_key = $core->auth->setRecoverKey($user_id, $user_email);
        $subject = mail::B64Header('DotClear ' . __('Password reset'));
        $message = __('Someone has requested to reset the password for the following site and username.') . "\n\n" . $page_url . "\n" . __('Username:') . ' ' . $user_id . "\n\n" . __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\n" . $page_url . '?akey=' . $recover_key;
        $headers[] = 'From: ' . (defined('DC_ADMIN_MAILFROM') && DC_ADMIN_MAILFROM ? DC_ADMIN_MAILFROM : 'dotclear@local');
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';
        mail::sendMail($user_email, $subject, $message, $headers);
        $msg = sprintf(__('The e-mail was sent successfully to %s.'), $user_email);
    } catch (Exception $e) {
        $err = $e->getMessage();
    }
} elseif ($akey) {
    try {
        $recover_res = $core->auth->recoverUserPassword($akey);
        $subject = mb_encode_mimeheader('DotClear ' . __('Your new password'), 'UTF-8', 'B');
        $message = __('Username:') . ' ' . $recover_res['user_id'] . "\n" . __('Password:') . ' ' . $recover_res['new_pass'] . "\n\n" . preg_replace('/\\?(.*)$/', '', $page_url);
        $headers[] = 'From: dotclear@' . $_SERVER['HTTP_HOST'];
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';
开发者ID:nikrou,项目名称:dotclear,代码行数:31,代码来源:auth.php

示例2: substr

    $user_id = @unpack('a32', @pack('H*', $user_id));
    if (is_array($user_id)) {
        $user_id = $user_id[1];
        $user_key = substr($_COOKIE['bp_admin'], 0, 40);
        $user_pwd = null;
    } else {
        $user_id = null;
    }
}
# Recover password
if ($recover && !empty($_POST['user_id']) && !empty($_POST['user_email'])) {
    $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
    $user_email = !empty($_POST['user_email']) ? $_POST['user_email'] : '';
    try {
        $recover_key = $core->auth->setRecoverKey($user_id, $user_email);
        $subject = mail::B64Header('Bilboplanet' . T_('Password reset'));
        $message = T_('Someone has requested to reset the password for the following site and username.') . "\n\n" . $page_url . "\n" . T_('User_id:') . ' ' . $user_id . "\n\n" . T_('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\n" . $page_url . '?akey=' . $recover_key;
        $headers[] = 'From: bilboplanet@' . $_SERVER['HTTP_HOST'];
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';
        mail::sendMail($user_email, $subject, $message, $headers);
        $msg = sprintf(T_('The e-mail was sent successfully to %s.'), $user_email);
    } catch (Exception $e) {
        $err = $e->getMessage();
    }
} elseif ($akey) {
    try {
        $recover_res = $core->auth->recoverUserPassword($akey);
        $subject = mb_encode_mimeheader('Bilboplanet ' . T_('Your new password'), 'UTF-8', 'B');
        $message = T_('Username:') . ' ' . $recover_res['user_id'] . "\n" . T_('Password:') . ' ' . $recover_res['new_pass'] . "\n\n" . preg_replace('/\\?(.*)$/', '', $page_url);
        $headers[] = 'From: bilboplanet@' . $_SERVER['HTTP_HOST'];
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';
开发者ID:archcidburnziso,项目名称:Bilboplanet,代码行数:31,代码来源:auth.php


注:本文中的mail::B64Header方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。