當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。