public function getBackPwd()
 {
     $where['admin_email'] = $rootemail = I('post.rootemail');
     $where['name'] = $name = I('post.rootname');
     $pattern = '/^[0-9A-Za-z-\\._]+@\\w+(\\.(\\w){1,3}){1,3}$/';
     $subject = $rootemail;
     if (!preg_match($pattern, $subject)) {
         $this->redirect(U('Server/Admin'));
         die;
     } else {
         $tplObj = M('sys_email_templates');
         $tpl_status = $tplObj->field('subject,content,status')->where($where)->find();
         if ($tpl_status['status']) {
             //发邮件
             $to = $rootemail;
             //接收邮件邮箱
             $subject = $tpl_status['subject'];
             $content = $tpl_status['content'];
             //模板中包含标示
             // 自定义邮件发送内容
             $url = 'http://' . I('server.HTTP_HOST') . __APP__ . __CONTROLLER__ . '/repwd/code/' . think_encrypt($to);
             //此处加密未随机待完善
             $username = '******' . date('Y年m月d分 H时i分s秒') . '申请找回密码<strong style="color:#00acff;">' . $rootemail . '</strong>';
             $sy_webname = C('site_name');
             $url = '<a href="' . $url . '">' . $url . '</a>';
             $sy_webcopyright = C('copyright');
             // 邮件内容正则
             $pattern = array('/{sy_webname}/', '/{sy_webcopyright}/', '/{username}/', '/{url}/');
             $replacement = array($sy_webname, $sy_webcopyright, $username, $url);
             //替换模板中标签成实际内容
             $newSubject = preg_replace($pattern, $replacement, $subject);
             $newContent = preg_replace($pattern, $replacement, $content);
             //dump($newSubject);
             //dump($newContent);exit;
             $email = sendEMail($to, $newSubject, $newContent);
             //发送成功直接修改数据密码
             if ($email) {
                 //修改发送邮件时间,便用于邮件过期处理
                 $Model = M('root_admin');
                 $Model->where("name='{$name}'")->setField('this_time', time());
             } else {
                 $this->success('邮件发送失败,返回重试', U('Server/Admin'), 3);
             }
         } else {
             $this->error('管理员关闭找回密码功能', U('Server/Admin'), 3);
         }
     }
     //考虑调试邮箱登陆接口(未尝试过)
     $this->success('请查收您的邮件', U('Admin/index'), 3);
     /*
     		$to ='*****@*****.**';
     		$subject = '主题';
     		$content = '内容';
     		$email = sendEMail($to, $subject, $content);*/
     //dump($email);
 }
Exemplo n.º 2
0
 /**
  * Toggles the active flag on the user account
  *
  * @version 1.0
  * @since   1.0.0
  * @author  xLink
  *
  * @param   int     $uid        UserID
  * @param   bool    $state      true to activate the user,
  *                                  false to deactivate the user,
  *                                  null to toggle it
  *
  * @return  bool
  */
 public function toggleActivation($uid, $state = null)
 {
     //if nothing was given, grab the current state
     if (is_null($state)) {
         $state = $this->getUserInfo($uid, 'active');
     }
     //switch these around, if true we want to activate
     if ($state === true || $state == 1) {
         $state = 0;
     }
     //false should deactivate
     if ($state === false || $state == 0) {
         $state = 1;
     }
     switch ($state) {
         // deactivate the account
         case 1:
             $active = array('active' => '0');
             sendEMail($this->userData['email'], 'E_LOGIN_ATTEMPTS', array('username' => $this->userData['username'], 'url' => $this->config('global', 'rootUrl') . 'login.php?action=active&un=' . $this->userData['id'] . '&check=' . $this->userData['usercode']));
             break;
             // activate the account
         // activate the account
         case 0:
             $active = array('active' => '1');
             break;
         default:
             return false;
             break;
     }
     //update the user row
     $this->objUser->updateUserSettings($uid, $active);
     //and hook here
     $this->objPlugins->hook('CMSUser_active', $active);
     return true;
 }
Exemplo n.º 3
0
    //or die ("<br>Invalid query: " . mysql_error());
    if (mysql_result($query, 0) > 0) {
        $err[] = "User with this email already exists in the system.";
        //Пользователь с таким логином уже существует в базе данных
    }
    # Если нет ошибок, то добавляем в БД нового пользователя
    if (count($err) == 0) {
        $pswd = mb_strtolower(trim($_POST['password']));
        $salt = substr(md5($email), 10, 20) . "";
        $password = md5(md5($pswd) . $salt);
        mysql_query("INSERT INTO users SET email='" . $email . "', pswrd='" . $password . "'");
        $uid = (string) mysql_insert_id();
        $newVerCode = GUID();
        mysql_query("INSERT INTO verifi (idusr, vercode) VALUES ({$uid}, '{$newVerCode}');");
        // Отправляем письмо с проверочным адресом
        sendEMail(EMAIL_BOT, $email, "Verification PaperboD*", "Verification KEY: " . $newVerCode . "<br/><a href='" . URL_SITE_FULL . "/verifi/?k=" . $newVerCode . "'>Go verification</a>");
        header("Location: /login/");
        exit;
    }
}
require_once '../h.php';
?>

      <form class="form-signin" role="form" method="POST" action="">
        <h2 class="form-signin-heading">Please sign up</h2>
        <input type="email" name="email" id="reg_inp" class="form-control" placeholder="Email address" required autofocus>
        <input type="password" name="password" id="reg_inp" class="form-control" placeholder="Password" required>
        By clicking "Sign up", you agree to our <a href="#" data-toggle="modal" data-target="#myModalTerms">terms</a> of service.
        <button class="btn btn-lg btn-primary btn-block" type="submit" name="submit">Sign up</button>
      </form>
Exemplo n.º 4
0
        $headers = array('From' => $from, 'To' => $recipient, 'Subject' => $subject);
        $mime = new Mail_mime($crlf);
        $mime->setTXTBody($body_txt);
        if (is_file($file)) {
            $ctype = MIME_Type::autoDetect($file);
            $mime->addAttachment($file, $ctype);
        }
        $body = $mime->get();
        $hdrs = $mime->headers($headers);
        $mail =& Mail::factory($backend, $params);
        $mail->send($recipient, $hdrs, $body);
    }
}
$par['empfaenger'] = $reports_normal_recipients;
$par['message'] = array('subject' => "test", 'body_txt' => "test only");
sendEMail($par);
die;
$exasol_dsn = "odbc://*****:*****@/EXA_MUSIC";
require_once 'lib/pear/MDB2.php';
function firstkw($jahr)
{
    $erster = mktime(0, 0, 0, 1, 1, $jahr);
    $wtag = date('w', $erster);
    if ($wtag <= 4) {
        /**
        * Donnerstag oder kleiner: auf den Montag zur�ckrechnen.
        */
        $montag = mktime(0, 0, 0, 1, 1 - ($wtag - 1), $jahr);
    } else {
        /**
        * auf den Montag nach vorne rechnen.
Exemplo n.º 5
0
Pour vous connecter, allez sur
{$config['url']}users/login.php

Nexty.
END;
                } else {
                    $email = <<<END
Hello {$user_details['name']},

This is the username and password for your nexty account.

Username : {$user_details['username']}
Password : {$user_details['password']}

To login, please go to
{$config['url']}users/login.php

Nexty.
END;
                }
                sendEMail('', $user_details['email'], $email, t('Account Details of Nexty'));
                $QUERY['success'] = t('An email containing your username and password was send to %s', $user_details['email']);
            } else {
                $QUERY['error'] = t('There is no email address associated with this account. Sorry!');
            }
        } else {
            $QUERY['error'] = t('No user was found with the given username/email');
        }
    }
}
render();
function handle_notification()
{
    function getInt($strInt)
    {
        return intval(preg_replace("/[\"']/", "", $strInt));
    }
    $bib_ids = array_map("getInt", explode(',', $_REQUEST['bib_ids']));
    if (!count($bib_ids)) {
        return '<div style="color: red; font-weight: bold; padding: 5px;">(you must select at least one bookmark)</div>';
    }
    $bibIDList = join(',', $bib_ids);
    $notification_link = HEURIST_BASE_URL . '?db=' . HEURIST_DBNAME . '&w=all&q=ids:' . $bibIDList;
    $bib_titles = mysql__select_assoc('Records', 'rec_ID', 'rec_Title', 'rec_ID in (' . $bibIDList . ')');
    $title_list = "Id      Title\n" . "------  ---------\n";
    foreach ($bib_titles as $rec_id => $rec_title) {
        $title_list .= str_pad("{$rec_id}", 8) . $rec_title . "\n";
    }
    $msg = '';
    if ($_REQUEST['notify_message'] && $_REQUEST['notify_message'] != '(enter message here)') {
        $msg = '"' . $_REQUEST['notify_message'] . '"' . "\n\n";
    }
    $res = mysql_query('select ' . USERS_EMAIL_FIELD . ' from ' . USERS_DATABASE . '.' . USERS_TABLE . ' where ' . USERS_ID_FIELD . ' = ' . get_user_id());
    $row = mysql_fetch_row($res);
    if ($row) {
        $user_email = $row[0];
    }
    mysql_connection_overwrite(DATABASE);
    $email_subject = 'Email from ' . get_user_name();
    if (count($bib_ids) == 1) {
        $email_subject .= ' (one reference)';
    } else {
        $email_subject .= ' (' . count($bib_ids) . ' references)';
    }
    $email_headers = 'From: ' . get_user_name() . ' <no-reply@' . HEURIST_SERVER_NAME . '>';
    if ($user_email) {
        $email_headers .= "\r\nCc: " . get_user_name() . ' <' . $user_email . '>';
        $email_headers .= "\r\nReply-To: " . get_user_name() . ' <' . $user_email . '>';
    }
    $email_text = get_user_name() . " would like to draw some records to your attention, with the following note:\n\n" . $msg . "Access them and add them (if desired) to your Heurist records at: \n\n" . $notification_link . "\n\n" . "To add records, either click on the unfilled star left of the title\n" . "or select the ones you wish to add and then Selected > Bookmark\n\n" . $title_list;
    if ($_REQUEST['notify_group']) {
        $email_headers = preg_replace('/Cc:[^\\r\\n]*\\r\\n/', '', $email_headers);
        $res = mysql_query('select ' . GROUPS_NAME_FIELD . ' from ' . USERS_DATABASE . '.' . GROUPS_TBALE . ' where ' . GROUPS_ID_FIELD . '=' . intval($_REQUEST['notify_group']));
        $row = mysql_fetch_assoc($res);
        $grpname = $row[GROUPS_NAME_FIELD];
        $res = mysql_query('select ' . USERS_EMAIL_FIELD . '
				from ' . USERS_DATABASE . '.' . USERS_TABLE . ' left join ' . USERS_DATABASE . '.' . USER_GROUPS_TABLE . ' on ' . USER_GROUPS_USER_ID_FIELD . '=' . USERS_ID_FIELD . '
				where ' . USER_GROUPS_GROUP_ID_FIELD . '=' . intval($_REQUEST['notify_group']));
        $count = mysql_num_rows($res);
        while ($row = mysql_fetch_assoc($res)) {
            $email_headers .= "\r\nBcc: " . $row[USERS_EMAIL_FIELD];
        }
        $rv = sendEMail(get_user_name() . ' <' . $user_email . '>', $email_subject, $email_text, $email_headers, true);
        return $rv == "ok" ? 'Notification email sent to group ' . $grpname . ' (' . $count . ' members)' : $rv;
    } else {
        if ($_REQUEST['notify_person']) {
            $res = mysql_query('select ' . USERS_EMAIL_FIELD . ', concat(' . USERS_FIRSTNAME_FIELD . '," ",' . USERS_LASTNAME_FIELD . ') as fullname from ' . USERS_DATABASE . '.' . USERS_TABLE . ' where ' . USERS_ID_FIELD . '=' . $_REQUEST['notify_person']);
            $psn = mysql_fetch_assoc($res);
            $rv = sendEMail($psn[USERS_EMAIL_FIELD], $email_subject, $email_text, $email_headers, true);
            return $rv == "ok" ? 'Notification email sent to ' . addslashes($psn['fullname']) : $rv;
        } else {
            if ($_REQUEST['notify_email']) {
                $rv = sendEMail($_REQUEST['notify_email'], $email_subject, $email_text, $email_headers, true);
                return $rv == "ok" ? 'Notification email sent to ' . addslashes($_REQUEST['notify_email']) : $rv;
            } else {
                return '<div style="color: red; font-weight: bold; padding: 5px;">(you must select a group, person, or enter an email address)</div>';
            }
        }
    }
}
Exemplo n.º 7
0
        $err[] = "Incorrect email!";
    }
    # проверяем, сущестует ли пользователя с таким именем
    $query = mysql_query("SELECT COUNT(id) FROM users WHERE email='" . mysql_real_escape_string($email) . "'");
    //or die ("<br>Invalid query: " . mysql_error());
    if (mysql_result($query, 0) > 0) {
        $qrID = mysql_query("SELECT id FROM users WHERE email='" . mysql_real_escape_string($email) . "' LIMIT 1");
        while ($rwID = mysql_fetch_array($qrID)) {
            $uid = $rwID['id'];
            $strTxtPswrd = generateCode();
            $pswd = mb_strtolower(trim($strTxtPswrd));
            $salt = substr(md5($email), 10, 20) . "";
            $password = md5(md5($pswd) . $salt);
            mysql_query("UPDATE users SET pswrd = '" . $password . "' WHERE id='" . $uid . "'");
            // Отправляем письмо с проверочным адресом
            sendEMail(EMAIL_BOT, $email, "New data for PaperboD*", "New password: "******"");
        }
        header("Location: /login/");
        exit;
    } else {
        $err[] = "User with this email does not exist in the system.";
        //Пользователь с таким логином не существует в базе данных
    }
}
require_once '../../h.php';
if (isset($err)) {
    print '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>';
    print '<b>When verification the following errors occurred:</b><br>';
    //При верификации произошли следующие ошибки:
    foreach ($err as $error) {
        print $error . "<br>";