• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP email_user函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中email_user函数的典型用法代码示例。如果您正苦于以下问题:PHP email_user函数的具体用法?PHP email_user怎么用?PHP email_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: notify_user

 public static function notify_user($user, $data)
 {
     $lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
     $separator = str_repeat('-', 72);
     $sitename = get_config('sitename');
     $subject = get_string_from_language($lang, 'emailsubject', 'notification.email', $sitename);
     if (!empty($data->subject)) {
         $subject .= ': ' . $data->subject;
     }
     $messagebody = get_string_from_language($lang, 'emailheader', 'notification.email', $sitename) . "\n";
     $messagebody .= $separator . "\n\n";
     $messagebody .= get_string_from_language($lang, 'subject') . ': ' . $data->subject . "\n\n";
     if ($data->activityname == 'usermessage') {
         // Do not include the message body in user messages when they are sent by email
         // because it encourages people to reply to the email.
         $messagebody .= get_string_from_language($lang, 'newusermessageemailbody', 'group', display_name($data->userfrom), $data->url);
     } else {
         $messagebody .= $data->message;
         if (!empty($data->url)) {
             $messagebody .= "\n\n" . get_string_from_language($lang, 'referurl', 'notification.email', $data->url);
         }
     }
     if (isset($data->unsubscribeurl) && isset($data->unsubscribename)) {
         $messagebody .= "\n\n" . get_string_from_language($lang, 'unsubscribemessage', 'notification.email', $data->unsubscribename, $data->unsubscribeurl);
     }
     $messagebody .= "\n\n{$separator}";
     $prefurl = get_config('wwwroot') . 'account/activity/preferences/';
     $messagebody .= "\n\n" . get_string_from_language($lang, 'emailfooter', 'notification.email', $sitename, $prefurl);
     email_user($user, null, $subject, $messagebody, null, !empty($data->customheaders) ? $data->customheaders : null);
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:30,代码来源:lib.php


示例2: notify_user

 public static function notify_user($user, $data)
 {
     $messagehtml = null;
     if (!empty($data->overridemessagecontents)) {
         $subject = $data->subject;
         if (!empty($data->emailmessage)) {
             $messagebody = $data->emailmessage;
         } else {
             if (!empty($user->emailmessage)) {
                 $messagebody = $user->emailmessage;
             } else {
                 $messagebody = $data->message;
             }
         }
         if (!empty($data->htmlmessage)) {
             $messagehtml = $data->htmlmessage;
         } else {
             if (!empty($user->htmlmessage)) {
                 $messagehtml = $user->htmlmessage;
             }
         }
     } else {
         $lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
         $separator = str_repeat('-', 72);
         $sitename = get_config('sitename');
         $subject = get_string_from_language($lang, 'emailsubject', 'notification.email', $sitename);
         if (!empty($data->subject)) {
             $subject .= ': ' . $data->subject;
         }
         $messagebody = get_string_from_language($lang, 'emailheader', 'notification.email', $sitename) . "\n";
         $messagebody .= $separator . "\n\n";
         $messagebody .= get_string_from_language($lang, 'subject') . ': ' . $data->subject . "\n\n";
         if ($data->url && stripos($data->url, 'http://') !== 0 && stripos($data->url, 'https://') !== 0) {
             $data->url = get_config('wwwroot') . $data->url;
         }
         if ($data->activityname == 'usermessage') {
             // Do not include the message body in user messages when they are sent by email
             // because it encourages people to reply to the email.
             $messagebody .= get_string_from_language($lang, 'newusermessageemailbody', 'group', display_name($data->userfrom), $data->url);
         } else {
             $messagebody .= $data->message;
             if (!empty($data->url)) {
                 $messagebody .= "\n\n" . get_string_from_language($lang, 'referurl', 'notification.email', $data->url);
             }
         }
         $messagebody .= "\n\n{$separator}";
         $prefurl = get_config('wwwroot') . 'account/activity/preferences/index.php';
         $messagebody .= "\n\n" . get_string_from_language($lang, 'emailfooter', 'notification.email', $sitename, $prefurl);
     }
     // Bug 738263: Put the user's email address in the Reply-to field; email_user() will put the site address in 'From:'
     $userfrom = null;
     if (!empty($data->fromuser) && !$data->hideemail) {
         $user_data = get_record('usr', 'id', $data->fromuser);
         if (empty($data->customheaders)) {
             $data->customheaders = array();
         }
         $data->customheaders[] = "Reply-to: {$user_data->email}";
     }
     email_user($user, $userfrom, $subject, $messagebody, $messagehtml, !empty($data->customheaders) ? $data->customheaders : null);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:60,代码来源:lib.php


示例3: register_submit

function register_submit(Pieform $form, $values)
{
    global $SESSION;
    // store password encrypted
    // don't die_info, since reloading the page shows the login form.
    // instead, redirect to some other page that says this
    safe_require('auth', 'internal');
    $values['salt'] = substr(md5(rand(1000000, 9999999)), 2, 8);
    $values['password'] = AuthInternal::encrypt_password($values['password1'], $values['salt']);
    $values['key'] = get_random_key();
    // @todo the expiry date should be configurable
    $values['expiry'] = db_format_timestamp(time() + 86400);
    $values['lang'] = $SESSION->get('lang');
    try {
        insert_record('usr_registration', $values);
        $f = fopen('/tmp/donal.txt', 'w');
        fwrite($f, get_string('registeredemailmessagetext', 'auth.internal', $values['firstname'], get_config('sitename'), get_config('wwwroot'), $values['key'], get_config('sitename')));
        $user = (object) $values;
        $user->admin = 0;
        $user->staff = 0;
        email_user($user, null, get_string('registeredemailsubject', 'auth.internal', get_config('sitename')), get_string('registeredemailmessagetext', 'auth.internal', $values['firstname'], get_config('sitename'), get_config('wwwroot'), $values['key'], get_config('sitename')), get_string('registeredemailmessagehtml', 'auth.internal', $values['firstname'], get_config('sitename'), get_config('wwwroot'), $values['key'], get_config('wwwroot'), $values['key'], get_config('sitename')));
    } catch (EmailException $e) {
        log_warn($e);
        die_info(get_string('registrationunsuccessful', 'auth.internal'));
    } catch (SQLException $e) {
        log_warn($e);
        die_info(get_string('registrationunsuccessful', 'auth.internal'));
    }
    // Add a marker in the session to say that the user has registered
    $_SESSION['registered'] = true;
    redirect('/register.php');
}
开发者ID:Br3nda,项目名称:mahara,代码行数:32,代码来源:register.php


示例4: execute

 function execute(&$request)
 {
     /* Create the ancestors bar */
     k4_bread_crumbs($request['template'], $request['dba'], 'L_RESENDVALIDATIONEMAIL');
     /* Check if the user is logged in or not */
     if ($request['user']->isMember()) {
         no_perms_error($request);
         return TRUE;
     }
     if (!$this->runPostFilter('email', new FARequiredFilter())) {
         $action = new K4InformationAction(new K4LanguageElement('L_SUPPLYEMAIL'), 'content', TRUE);
         return $action->execute($request);
     }
     if (!$this->runPostFilter('email', new FARegexFilter('~^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$~'))) {
         $action = new K4InformationAction(new K4LanguageElement('L_NEEDVALIDEMAIL'), 'content', TRUE);
         return $action->execute($request);
     }
     $user = $request['dba']->getRow("SELECT * FROM " . K4USERS . " WHERE email = '" . $request['dba']->quote($_REQUEST['email']) . "'");
     if (!is_array($user) || empty($user)) {
         $action = new K4InformationAction(new K4LanguageElement('L_INVALIDEMAILRVE', $_REQUEST['email']), 'content', TRUE);
         return $action->execute($request);
     }
     if ($user['reg_key'] == '') {
         $action = new K4InformationAction(new K4LanguageElement('L_USERREGGEDRVE'), 'content', TRUE);
         return $action->execute($request);
     }
     //  .'/member.php?act=activate_accnt&key='. $user['reg_key']
     $url = new FAUrl(K4_URL);
     $url->file = 'member.php';
     $url->args = array('act' => 'activate_accnt', 'key' => $user['reg_key']);
     $email = sprintf($request['template']->getVar('L_REGISTEREMAILRMSG'), $user['name'], $request['template']->getVar('bbtitle'), str_replace('&', '&', $url->__toString()), $request['template']->getVar('bbtitle'));
     email_user($user['email'], $request['template']->getVar('bbtitle') . ' - ' . $request['template']->getVar('L_RESENDVALIDATIONEMAIL'), $email);
     $action = new K4InformationAction(new K4LanguageElement('L_RESENTREGEMAIL', $_REQUEST['email']), 'content', TRUE);
     return $action->execute($request);
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:35,代码来源:member.php


示例5: approveregistration_submit

function approveregistration_submit(Pieform $form, $values)
{
    global $SESSION;
    if (!empty($values['extra'])) {
        // The local_register_submit hook may have been used to put other values in
        // this column; if so, leave them in the db.
        $extra = unserialize($values['extra']);
    }
    $extra = !empty($extra) && $extra instanceof Stdclass ? $extra : new StdClass();
    // Get additional values to pass through to user creation
    if (!empty($values['institutionstaff'])) {
        $extra->institutionstaff = 1;
    }
    $values['extra'] = serialize($extra);
    // update expiry time and set pending to a value that identify
    // it as approved (2)
    $values['pending'] = 2;
    $values['expiry'] = db_format_timestamp(time() + 86400);
    // now + 1 day
    update_record('usr_registration', $values, array('email' => $values['email']));
    // send the user the official account completion email
    $user = (object) $values;
    $user->admin = 0;
    $user->staff = 0;
    email_user($user, null, get_string('registeredemailsubject', 'auth.internal', get_config('sitename')), get_string('registeredemailmessagetext', 'auth.internal', $user->firstname, get_config('sitename'), get_config('wwwroot'), $user->key, get_config('sitename')), get_string('registeredemailmessagehtml', 'auth.internal', $user->firstname, get_config('sitename'), get_config('wwwroot'), $user->key, get_config('wwwroot'), $user->key, get_config('sitename')));
    $SESSION->add_ok_msg(get_string('registrationapprovedsuccessfully', 'admin'));
    redirect('/admin/users/pendingregistrations.php?institution=' . $user->institution);
}
开发者ID:kienv,项目名称:mahara,代码行数:28,代码来源:actionregistration.php


示例6: send_digest

 public static function send_digest()
 {
     $users = array();
     $sitename = get_config('sitename');
     $types = get_records_assoc('activity_type', 'admin', 0, 'plugintype,pluginname,name', 'id,name,plugintype,pluginname');
     foreach ($types as &$type) {
         if (!empty($type->plugintype)) {
             $type->section = "{$type->plugintype}.{$type->pluginname}";
         } else {
             $type->section = "activity";
         }
     }
     $sql = 'SELECT q.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, u.admin, u.staff,
                 p.value AS lang, q.*,' . db_format_tsfield('ctime') . '
             FROM {usr} u 
                 JOIN {notification_emaildigest_queue} q
                     ON q.usr = u.id
                 LEFT OUTER JOIN {usr_account_preference} p ON (p.usr = u.id AND p.field = \'lang\')
             ORDER BY usr,type,q.ctime';
     if ($tosend = get_records_sql_array($sql, array())) {
         foreach ($tosend as $queue) {
             if (!isset($users[$queue->usr])) {
                 $users[$queue->usr] = new StdClass();
                 $users[$queue->usr]->user = new StdClass();
                 $users[$queue->usr]->user->username = $queue->username;
                 $users[$queue->usr]->user->firstname = $queue->firstname;
                 $users[$queue->usr]->user->lastname = $queue->lastname;
                 $users[$queue->usr]->user->preferredname = $queue->preferredname;
                 $users[$queue->usr]->user->email = $queue->email;
                 $users[$queue->usr]->user->admin = $queue->admin;
                 $users[$queue->usr]->user->staff = $queue->staff;
                 $users[$queue->usr]->user->id = $queue->usr;
                 $users[$queue->usr]->user->lang = empty($queue->lang) || $queue->lang == 'default' ? get_config('lang') : $queue->lang;
                 $users[$queue->usr]->entries = array();
             }
             $queue->nicetype = get_string_from_language($users[$queue->usr]->user->lang, 'type' . $types[$queue->type]->name, $types[$queue->type]->section);
             $users[$queue->usr]->entries[$queue->id] = $queue;
         }
     }
     foreach ($users as $user) {
         $lang = $user->user->lang;
         $subject = get_string_from_language($lang, 'emailsubject', 'notification.emaildigest', $sitename);
         $body = get_string_from_language($lang, 'emailbodynoreply', 'notification.emaildigest', $sitename);
         foreach ($user->entries as $entry) {
             $body .= get_string_from_language($lang, 'type', 'activity') . ': ' . $entry->nicetype . ' ' . get_string_from_language($lang, 'attime', 'activity') . ' ' . format_date($entry->ctime) . "\n";
             if (!empty($entry->subject)) {
                 $body .= get_string_from_language($lang, 'subject') . $entry->subject . "\n";
             }
             if (!empty($entry->message)) {
                 $body .= "\n" . $entry->message;
             }
             if (!empty($entry->url)) {
                 $body .= "\n" . $entry->url;
             }
             $body .= "\n\n";
         }
         $prefurl = get_config('wwwroot') . 'account/activity/preferences/';
         $body .= "\n\n" . get_string_from_language($lang, 'emailbodyending', 'notification.emaildigest', $prefurl);
         try {
             email_user($user->user, null, $subject, $body);
             //only delete them if the email succeeded!
             $in = db_array_to_ph($user->entries);
             delete_records_select('notification_emaildigest_queue', 'id IN (' . implode(', ', $in) . ')', array_keys($user->entries));
         } catch (Exception $e) {
             // @todo
         }
     }
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:68,代码来源:lib.php


示例7: removeMemberSetPassword

 /**
  * Reset user's password, and send them a password change email
  */
 private function removeMemberSetPassword(&$user)
 {
     global $SESSION, $USER;
     if ($user->id == $USER->id) {
         $user->passwordchange = 1;
         return;
     }
     try {
         $pwrequest = new StdClass();
         $pwrequest->usr = $user->id;
         $pwrequest->expiry = db_format_timestamp(time() + 86400);
         $pwrequest->key = get_random_key();
         $sitename = get_config('sitename');
         $fullname = display_name($user, null, true);
         email_user($user, null, get_string('noinstitutionsetpassemailsubject', 'mahara', $sitename, $this->displayname), get_string('noinstitutionsetpassemailmessagetext', 'mahara', $fullname, $this->displayname, $sitename, $user->username, get_config('wwwroot'), $pwrequest->key, get_config('wwwroot'), $sitename, get_config('wwwroot'), $pwrequest->key), get_string('noinstitutionsetpassemailmessagehtml', 'mahara', $fullname, $this->displayname, $sitename, $user->username, get_config('wwwroot'), $pwrequest->key, get_config('wwwroot'), $pwrequest->key, get_config('wwwroot'), $sitename, get_config('wwwroot'), $pwrequest->key, get_config('wwwroot'), $pwrequest->key));
         insert_record('usr_password_request', $pwrequest);
     } catch (SQLException $e) {
         $SESSION->add_error_msg(get_string('forgotpassemailsendunsuccessful'));
     } catch (EmailException $e) {
         $SESSION->add_error_msg(get_string('forgotpassemailsendunsuccessful'));
     }
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:25,代码来源:institution.php


示例8: serialize

         $temp2[] = 0;
         for ($i = 1; $i <= $temp['options'][0]; $i++) {
             $temp2[] = $_POST[$temp['name'] . $i] ? 1 : 0;
         }
         $custom[$temp['name']] = $temp2;
     } else {
         $custom[$temp['name']] = $_POST[$temp['name']];
     }
 }
 $custom = serialize($custom);
 if (pageauth("users", "limit") == 0) {
     if ($status != $user['status']) {
         if ($status == 1) {
             email_user($user['id'], "account_actived");
         } else {
             email_user($user['id'], "account_deactiv");
         }
     }
     $insertSQL = sprintf("uname=%s, status=%s, timezone=%s, firstname=%s, lastname=%s, email=%s, custom=%s", safesql($username, "text"), safesql($status, "text"), safesql($_POST['zone'], "text"), safesql($firstname, "text"), safesql($lastname, "text"), safesql($email, "text"), safesql($custom, "text"));
     if ($password) {
         $insertSQL .= ", passwd=" . safesql(md5($password), "text");
     }
     $Result1 = $data->update_query("users", $insertSQL, "id={$id}");
     if ($Result1) {
         show_admin_message("User details updated", "admin.php?page=users");
     }
 } else {
     $insertSQL = sprintf("firstname=%s, lastname=%s, email=%s, custom=%", safesql($firstname, "text"), safesql($lastname, "text"), safesql($email, "text"), safesql($custom, "text"));
     $Result1 = $data->update_query("users", $insertSQL, "id={$id}");
     if ($Result1) {
         show_admin_message("User details updated", "admin.php?page=users");
开发者ID:burak-tekin,项目名称:CMScout2,代码行数:31,代码来源:admin_user_edit.php


示例9: forgotpass_submit

function forgotpass_submit(Pieform $form, $values)
{
    global $SESSION;
    try {
        if (!($user = get_record_sql('SELECT * FROM {usr} WHERE LOWER(email) = ?', array(strtolower($values['emailusername']))))) {
            if (!($user = get_record_sql('SELECT * FROM {usr} WHERE LOWER(username) = ?', array(strtolower($values['emailusername']))))) {
                die_info(get_string('forgotpassnosuchemailaddressorusername'));
            }
        }
        $pwrequest = new StdClass();
        $pwrequest->usr = $user->id;
        $pwrequest->expiry = db_format_timestamp(time() + 86400);
        $pwrequest->key = get_random_key();
        $sitename = get_config('sitename');
        $fullname = display_name($user);
        email_user($user, null, get_string('forgotusernamepasswordemailsubject', 'mahara', $sitename), get_string('forgotusernamepasswordemailmessagetext', 'mahara', $fullname, $sitename, $user->username, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'contact.php', $sitename), get_string('forgotusernamepasswordemailmessagehtml', 'mahara', $fullname, $sitename, $user->username, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'contact.php', $sitename));
        insert_record('usr_password_request', $pwrequest);
    } catch (SQLException $e) {
        die_info(get_string('forgotpassemailsendunsuccessful'));
    } catch (EmailDisabledException $e) {
        die_info(get_string('forgotpassemaildisabled'));
    } catch (EmailException $e) {
        die_info(get_string('forgotpassemailsendunsuccessful'));
    }
    // Add a marker in the session to say that the user has registered
    $_SESSION['pwchangerequested'] = true;
    redirect('/forgotpass.php');
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:28,代码来源:forgotpass.php


示例10: clam_mail_admins

/**
 * Emails admins about a clam outcome
 *
 * @param string $notice The body of the email to be sent.
 */
function clam_mail_admins($notice)
{
    $subject = get_string('clamemailsubject', 'mahara', get_config('sitename'));
    $adminusers = get_records_array('usr', 'admin', 1);
    if ($adminusers) {
        foreach ($adminusers as $admin) {
            // This should probably be some kind of notification
            // rather than an email
            email_user($admin, null, $subject, $notice);
        }
    }
}
开发者ID:Br3nda,项目名称:mahara,代码行数:17,代码来源:uploadmanager.php


示例11: mail

    $msg = "Dear " . $firstname . ",\n\nYour Heurist password has been reset.\n\nYour username is: " . $username . "\nYour new password is: " . $passwd . "\n\nTo change your password go to My Profile -> My User Info in the top right menu\n\nYou will first be asked to log in with the new password above.\n";
    mail($email, 'Heurist password reset', $msg, 'From: ' . HEURIST_MAIL_TO_INFO);
}
if (@$_REQUEST['username']) {
    mysql_connection_overwrite(USERS_DATABASE);
    $username = addslashes($_REQUEST['username']);
    $res = mysql_query('select ugr_ID,ugr_eMail,ugr_FirstName,ugr_Name from sysUGrps usr where usr.ugr_Name = "' . $username . '" or ugr_eMail = "' . $username . '"');
    $row = mysql_fetch_assoc($res);
    $username = $row['ugr_Name'];
    $user_id = $row['ugr_ID'];
    $email = $row['ugr_eMail'];
    $firstname = $row['ugr_FirstName'];
    if ($user_id) {
        $new_passwd = generate_passwd();
        mysql_query('update sysUGrps usr set ugr_Password = "' . hash_it($new_passwd) . '" where ugr_ID = ' . $user_id);
        email_user($user_id, $firstname, $email, $new_passwd, $username);
        print '<p>Your password has been reset.  You should receive an email shortly with your new password.</p>' . "\n";
    } else {
        $error = '<p style="color: red;">Username does not exist</p>' . "\n";
    }
}
if (!$_REQUEST['username'] || $error) {
    ?>
<p>Enter your username OR email address below and a new password will be emailed to you.</p>
<?php 
    echo $error;
    ?>
<form method="get">
 <input type="hidden" name="db" value="<?php 
    echo HEURIST_DBNAME;
    ?>
开发者ID:beoutsports,项目名称:heurist-v3-1,代码行数:31,代码来源:resetUserPassword.php


示例12: auth_handle_institution_expiries

/**
 * Sends notification e-mails to site and institutional admins when:
 *
 *  - An institution is expiring within the institution expiry warning
 *    period, set in site options.
 *
 * The actual prevention of users logging in is handled by the authentication
 * code. This cron job sends e-mails to notify users that these events will
 * happen soon.
 */
function auth_handle_institution_expiries()
{
    // The 'expiry' flag on the usr table
    $sitename = get_config('sitename');
    $wwwroot = get_config('wwwroot');
    $expire = get_config('institutionautosuspend');
    $warn = get_config('institutionexpirynotification');
    $daystoexpire = ceil($warn / 86400) . ' ';
    $daystoexpire .= $daystoexpire == 1 ? get_string('day') : get_string('days');
    // Get site administrators
    $siteadmins = get_records_sql_array('SELECT u.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, u.admin, u.staff FROM {usr} u WHERE u.admin = 1', array());
    // Expiry warning messages
    if ($institutions = get_records_sql_array('SELECT i.name, i.displayname FROM {institution} i ' . 'WHERE ' . db_format_tsfield('i.expiry', false) . ' < ? AND suspended != 1 AND expirymailsent != 1', array(time() + $warn))) {
        foreach ($institutions as $institution) {
            $institution_displayname = $institution->displayname;
            // Email site administrators
            foreach ($siteadmins as $user) {
                $user_displayname = display_name($user);
                email_user($user, null, get_string('institutionexpirywarning'), get_string('institutionexpirywarningtext_site', 'mahara', $user_displayname, $institution_displayname, $daystoexpire, $sitename, $sitename), get_string('institutionexpirywarninghtml_site', 'mahara', $user_displayname, $institution_displayname, $daystoexpire, $sitename, $sitename));
            }
            // Email institutional administrators
            $institutionaladmins = get_records_sql_array('SELECT u.id, u.username, u.expiry, u.staff, u.admin AS siteadmin, ui.admin AS institutionadmin, u.firstname, u.lastname, u.email ' . 'FROM {usr_institution} ui JOIN {usr} u ON (ui.usr = u.id) WHERE ui.admin = 1', array());
            foreach ($institutionaladmins as $user) {
                $user_displayname = display_name($user);
                email_user($user, null, get_string('institutionexpirywarning'), get_string('institutionexpirywarningtext_institution', 'mahara', $user_displayname, $institution_displayname, $sitename, $daystoexpire, $wwwroot . 'contact.php', $sitename), get_string('institutionexpirywarninghtml_institution', 'mahara', $user_displayname, $institution_displayname, $sitename, $daystoexpire, $wwwroot . 'contact.php', $sitename));
            }
            set_field('institution', 'expirymailsent', 1, 'name', $institution->name);
        }
    }
    // If we can automatically suspend expired institutions
    $autosuspend = get_config('institutionautosuspend');
    if ($autosuspend) {
        // Actual expired institutions
        if ($institutions = get_records_sql_array('SELECT name FROM {institution} ' . 'WHERE ' . db_format_tsfield('expiry', false) . ' < ?', array(time()))) {
            // Institutions have expired!
            foreach ($institutions as $institution) {
                set_field('institution', 'suspended', 1, 'name', $institution->name);
            }
        }
    }
}
开发者ID:Br3nda,项目名称:mahara,代码行数:51,代码来源:lib.php


示例13: cookie

<?php

include "../include.php";
cookie("last_login");
if ($posting) {
    if ($r = db_grab("SELECT userID FROM intranet_users WHERE email = '{$_POST["email"]}' AND isActive = 1")) {
        email_user($_POST["email"], "Reset Your Password", drawEmptyResult('To reset your password, please <a href="http://' . $_josh["request"]["host"] . '/login/password_reset.php?id=' . $r . '">follow this link</a>.'));
        url_change("password_confirm.php");
    } else {
        url_query_add(array("msg" => "email-not-found", "email" => $_POST["email"]));
        //bad email
    }
} elseif (isset($_GET["id"])) {
    db_query("UPDATE intranet_users SET password = PWDENCRYPT('') WHERE userID = {$_GET["id"]} AND isActive = 1");
    if ($r = db_grab("SELECT u.email, p.url FROM intranet_users u JOIN pages p ON u.homePageID = p.ID WHERE u.userID = {$_GET["id"]} AND u.isActive = 1")) {
        login($r["email"], "", true);
        cookie("last_login", $r["email"]);
        url_change($r["url"]);
    } else {
        url_change(false);
    }
}
?>
<html>
	<head>
		<title>Reset Your Password</title>
		<link rel="stylesheet" type="text/css" href="<?php 
echo $locale;
?>
style.css" />
		<script language="javascript" src="/javascript.js"></script>
开发者ID:joshreisner,项目名称:hcfa-cc,代码行数:31,代码来源:password_reset.php


示例14: _email_or_notify

function _email_or_notify($user, $subject, $bodytext, $bodyhtml)
{
    try {
        email_user($user, null, $subject, $bodytext, $bodyhtml);
    } catch (EmailDisabledException $e) {
        // Send a notification instead - email is disabled for this user
        $message = new StdClass();
        $message->users = array($user->id);
        $message->subject = $subject;
        $message->message = $bodytext;
        require_once 'activity.php';
        activity_occurred('maharamessage', $message);
    }
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:14,代码来源:lib.php


示例15: forgotpass_submit

function forgotpass_submit(Pieform $form, $values)
{
    global $SESSION;
    try {
        if (!($user = get_record_sql('SELECT u.* FROM {usr} u
            INNER JOIN {auth_instance} ai ON (u.authinstance = ai.id)
            WHERE (LOWER(u.email) = ? OR LOWER(u.username) = ?)
            AND ai.authname = \'internal\'', array_fill(0, 2, strtolower($values['emailusername']))))) {
            die_info(get_string('forgotpassnosuchemailaddressorusername'));
        }
        $pwrequest = new StdClass();
        $pwrequest->usr = $user->id;
        $pwrequest->expiry = db_format_timestamp(time() + 86400);
        $pwrequest->key = get_random_key();
        $sitename = get_config('sitename');
        $fullname = display_name($user);
        // Override the disabled status of this e-mail address
        $user->ignoredisabled = true;
        email_user($user, null, get_string('forgotusernamepasswordemailsubject', 'mahara', $sitename), get_string('forgotusernamepasswordemailmessagetext', 'mahara', $fullname, $sitename, $user->username, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'contact.php', $sitename), get_string('forgotusernamepasswordemailmessagehtml', 'mahara', $fullname, $sitename, $user->username, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'contact.php', $sitename));
        insert_record('usr_password_request', $pwrequest);
    } catch (SQLException $e) {
        die_info(get_string('forgotpassemailsendunsuccessful'));
    } catch (EmailException $e) {
        die_info(get_string('forgotpassemailsendunsuccessful'));
    }
    // Add a note if this e-mail address is over the bounce threshold to
    // warn users that they may not receive the e-mail
    if ($mailinfo = get_record_select('artefact_internal_profile_email', '"owner" = ? AND principal = 1', array($user->id))) {
        if (check_overcount($mailinfo)) {
            $SESSION->add_info_msg(get_string('forgotpassemailsentanyway1', 'mahara', get_config('sitename')));
        }
    }
    // Unsetting disabled status overriding
    unset($user->ignoredisabled);
    // Add a marker in the session to say that the user has registered
    $SESSION->set('pwchangerequested', true);
    redirect('/forgotpass.php');
}
开发者ID:rboyatt,项目名称:mahara,代码行数:38,代码来源:forgotpass.php


示例16: mysql_query

$result = mysql_query($query);
$users = array();
while ($row = mysql_fetch_row($result)) {
    $users[] = $row;
}
$count = count($users);
$extra_per = $extra / $count;
$new_users = array();
$total = 0;
foreach ($users as $user) {
    $row = $user;
    $row[2] += ceil($extra_per);
    $new_users[] = $row;
    $total += $row[2];
    if ($_POST['email']) {
        email_user($row[0], $row[1] . "@amiestreet.com", $row[2]);
    }
}
$users = $new_users;
$fund = $_POST['fund'];
$fund_needed = min($fund, ceil($_POST['tax'] + $_POST['tip'] - ceil($extra_per) * $count));
?>

<html>

<head><title>Tuk Tuk People</title></head>

<body>
<table>
<?php 
foreach ($users as $user) {
开发者ID:jganetsk,项目名称:tuk-tuk-orders,代码行数:31,代码来源:calc.php


示例17: set_random_key

    }
    return $string;
}
function set_random_key($key)
{
    $_SESSION['verify'] = $key;
}
if (isset($_SESSION['username'])) {
    $username = $_SESSION['username'];
    echo "You are already logged in as: {$username}";
    echo "<br>Please visit your control panel to edit your password.";
    die;
}
if (isset($_GET['email'])) {
    global $mysql;
    if (!is_null($_GET['email']) && !is_null($_GET['username'])) {
        $userEmail = strip_tags($_GET['email']);
        $user = strip_tags($_GET['username']);
        $mysql->dbconnect();
        $row = $mysql->dbquery_select('users', 'email', "username={$user}");
        $email = mysql_fetch_array($row);
        if ($userEmail == $email['email']) {
            $key = get_random_key();
            email_user($userEmail, $key);
            set_random_key($key);
            echo $key;
        } else {
            echo "Incorrect username or email address. <a href=\"request.php\">Try again</a>";
        }
    }
}
开发者ID:rileyjshaw,项目名称:angelhack-2012,代码行数:31,代码来源:request.php


示例18: adduser_submit

function adduser_submit(Pieform $form, $values)
{
    $user = new StdClass();
    $user->authinstance = $values['authinstance'];
    $user->username = $values['username'];
    $user->firstname = $values['firstname'];
    $user->lastname = $values['lastname'];
    $user->email = $values['email'];
    $user->password = $values['password'];
    $user->quota = $values['quota'];
    $user->passwordchange = 1;
    global $USER, $SESSION;
    if ($USER->get('admin')) {
        // Not editable by institutional admins
        $user->staff = (int) ($values['staff'] == 'on');
        $user->admin = (int) ($values['admin'] == 'on');
    }
    $authinstance = get_record('auth_instance', 'id', $values['authinstance']);
    if (!isset($values['remoteusername'])) {
        $values['remoteusername'] = null;
    }
    db_begin();
    $user->id = create_user($user, array(), $authinstance->institution, $authinstance, $values['remoteusername']);
    if (isset($user->admin) && $user->admin) {
        require_once 'activity.php';
        activity_add_admin_defaults(array($user->id));
    }
    if ($values['institutionadmin']) {
        set_field('usr_institution', 'admin', 1, 'usr', $user->id, 'institution', $authinstance->institution);
    }
    db_commit();
    try {
        email_user($user, $USER, get_string('accountcreated', 'mahara', get_config('sitename')), get_string('accountcreatedchangepasswordtext', 'mahara', $user->firstname, get_config('sitename'), $user->username, $user->password, get_config('wwwroot'), get_config('sitename')), get_string('accountcreatedchangepasswordhtml', 'mahara', $user->firstname, get_config('wwwroot'), get_config('sitename'), $user->username, $user->password, get_config('wwwroot'), get_config('wwwroot'), get_config('sitename')));
    } catch (EmailException $e) {
        $SESSION->add_error_msg(get_string('newuseremailnotsent', 'admin'));
    }
    redirect('/admin/users/edit.php?id=' . $user->id);
}
开发者ID:Br3nda,项目名称:mahara,代码行数:38,代码来源:add.php


示例19: profileform_submit

function profileform_submit(Pieform $form, $values)
{
    global $SESSION;
    global $USER;
    global $element_list;
    global $profilefields;
    require_once 'embeddedimage.php';
    db_begin();
    $now = db_format_timestamp(time());
    $email_errors = array();
    $lockedfields = locked_profile_fields();
    foreach ($element_list as $element => $type) {
        if (isset($lockedfields[$element]) && !$USER->get('admin')) {
            continue;
        }
        if ($element == 'email') {
            if (!isset($values['email']['unsent'])) {
                $values['email']['unsent'] = array();
            }
            // find new addresses
            foreach ($values['email']['unsent'] as $email) {
                if (in_array($email, $profilefields['email']['validated']) || in_array($email, $profilefields['email']['unvalidated'])) {
                    continue;
                }
                $key = get_random_key();
                $key_url = get_config('wwwroot') . 'artefact/internal/validate.php?email=' . rawurlencode($email) . '&key=' . $key;
                $key_url_decline = $key_url . '&decline=1';
                try {
                    $sitename = get_config('sitename');
                    email_user((object) array('id' => $USER->get('id'), 'username' => $USER->get('username'), 'firstname' => $USER->get('firstname'), 'lastname' => $USER->get('lastname'), 'preferredname' => $USER->get('preferredname'), 'admin' => $USER->get('admin'), 'staff' => $USER->get('staff'), 'email' => $email), null, get_string('emailvalidation_subject', 'artefact.internal'), get_string('emailvalidation_body1', 'artefact.internal', $USER->get('firstname'), $email, $sitename, $key_url, $sitename, $key_url_decline));
                } catch (EmailException $e) {
                    $email_errors[] = $email;
                }
                insert_record('artefact_internal_profile_email', (object) array('owner' => $USER->get('id'), 'email' => $email, 'verified' => 0, 'key' => $key, 'expiry' => db_format_timestamp(time() + 86400)));
            }
            // remove old addresses
            foreach ($profilefields['email']['validated'] as $email) {
                if (in_array($email, $values['email']['validated'])) {
                    continue;
                }
                if (!empty($values['email']['unvalidated']) && in_array($email, $values['email']['unvalidated'])) {
                    continue;
                }
                $artefact_id = get_field('artefact_internal_profile_email', 'artefact', 'email', $email, 'owner', $USER->get('id'));
                delete_records('artefact_internal_profile_email', 'email', $email, 'owner', $USER->get('id'));
                if ($artefact_id) {
                    $artefact = new ArtefactTypeEmail($artefact_id);
                    $artefact->delete();
                    // this is unset here to force the destructor to run now,
                    // rather than script exit time where it doesn't like
                    // throwing exceptions properly
                    unset($artefact);
                }
            }
            foreach ($profilefields['email']['unvalidated'] as $email) {
                if (in_array($email, $values['email']['validated']) || isset($values['email']['unvalidated']) && in_array($email, $values['email']['unvalidated'])) {
                    continue;
                }
                delete_records('artefact_internal_profile_email', 'email', $email, 'owner', $USER->get('id'));
            }
            if ($profilefields['email']['default'] != $values['email']['default']) {
                update_record('artefact_internal_profile_email', (object) array('principal' => 0), (object) array('ow 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP email_valide函数代码示例发布时间:2022-05-15
下一篇:
PHP email_to_user函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap