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


PHP MEMBER::exists方法代码示例

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


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

示例1: action_changemembersettings

 /**
  * @todo document this
  */
 function action_changemembersettings()
 {
     global $member, $CONF, $manager;
     $memberid = intRequestVar('memberid');
     // check if allowed
     $member->getID() == $memberid or $member->isAdmin() or $this->disallow();
     $name = trim(strip_tags(postVar('name')));
     $realname = trim(strip_tags(postVar('realname')));
     $password = postVar('password');
     $repeatpassword = postVar('repeatpassword');
     $email = strip_tags(postVar('email'));
     $url = strip_tags(postVar('url'));
     # replaced eregi() below with preg_match(). ereg* functions are deprecated in PHP 5.3.0
     # original eregi: !eregi("^https?://", $url)
     // begin if: sometimes user didn't prefix the URL with http:// or https://, this cause a malformed URL. Let's fix it.
     if (!preg_match('#^https?://#', $url)) {
         $url = 'http://' . $url;
     }
     $admin = postVar('admin');
     $canlogin = postVar('canlogin');
     $notes = strip_tags(postVar('notes'));
     $deflang = postVar('deflang');
     $mem = MEMBER::createFromID($memberid);
     if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
         if (!isValidDisplayName($name)) {
             $this->error(_ERROR_BADNAME);
         }
         if ($name != $mem->getDisplayName() && MEMBER::exists($name)) {
             $this->error(_ERROR_NICKNAMEINUSE);
         }
         if ($password != $repeatpassword) {
             $this->error(_ERROR_PASSWORDMISMATCH);
         }
         if ($password && strlen($password) < 6) {
             $this->error(_ERROR_PASSWORDTOOSHORT);
         }
         if ($password) {
             $pwdvalid = true;
             $pwderror = '';
             $manager->notify('PrePasswordSet', array('password' => $password, 'errormessage' => &$pwderror, 'valid' => &$pwdvalid));
             if (!$pwdvalid) {
                 $this->error($pwderror);
             }
         }
     }
     if (!isValidMailAddress($email)) {
         $this->error(_ERROR_BADMAILADDRESS);
     }
     if (!$realname) {
         $this->error(_ERROR_REALNAMEMISSING);
     }
     if ($deflang != '' && !checkLanguage($deflang)) {
         $this->error(_ERROR_NOSUCHLANGUAGE);
     }
     // check if there will remain at least one site member with both the logon and admin rights
     // (check occurs when taking away one of these rights from such a member)
     if (!$admin && $mem->isAdmin() && $mem->canLogin() || !$canlogin && $mem->isAdmin() && $mem->canLogin()) {
         $r = sql_query('SELECT * FROM ' . sql_table('member') . ' WHERE madmin=1 and mcanlogin=1');
         if (sql_num_rows($r) < 2) {
             $this->error(_ERROR_ATLEASTONEADMIN);
         }
     }
     if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
         $mem->setDisplayName($name);
         if ($password) {
             $mem->setPassword($password);
         }
     }
     $oldEmail = $mem->getEmail();
     $mem->setRealName($realname);
     $mem->setEmail($email);
     $mem->setURL($url);
     $mem->setNotes($notes);
     $mem->setLanguage($deflang);
     // only allow super-admins to make changes to the admin status
     if ($member->isAdmin()) {
         $mem->setAdmin($admin);
         $mem->setCanLogin($canlogin);
     }
     $autosave = postVar('autosave');
     $mem->setAutosave($autosave);
     $mem->write();
     // store plugin options
     $aOptions = requestArray('plugoption');
     NucleusPlugin::_applyPluginOptions($aOptions);
     $manager->notify('PostPluginOptionsUpdate', array('context' => 'member', 'memberid' => $memberid, 'member' => &$mem));
     // if email changed, generate new password
     if ($oldEmail != $mem->getEmail()) {
         $mem->sendActivationLink('addresschange', $oldEmail);
         // logout member
         $mem->newCookieKey();
         // only log out if the member being edited is the current member.
         if ($member->getID() == $memberid) {
             $member->logout();
         }
         $this->action_login(_MSG_ACTIVATION_SENT, 0);
         return;
//.........这里部分代码省略.........
开发者ID:hatone,项目名称:Nucleus-v3.64,代码行数:101,代码来源:ADMIN.php

示例2: create

 /**
  * Adds a new member
  *
  * @static
  */
 function create($name, $realname, $password, $email, $url, $admin, $canlogin, $notes)
 {
     if (!isValidMailAddress($email)) {
         return _ERROR_BADMAILADDRESS;
     }
     if (!isValidDisplayName($name)) {
         return _ERROR_BADNAME;
     }
     if (MEMBER::exists($name)) {
         return _ERROR_NICKNAMEINUSE;
     }
     if (!$realname) {
         return _ERROR_REALNAMEMISSING;
     }
     if (!$password) {
         return _ERROR_PASSWORDMISSING;
     }
     # replaced eregi() below with preg_match(). ereg* functions are deprecated in PHP 5.3.0
     # original eregi: !eregi("^https?://", $url)
     // begin if: sometimes user didn't prefix the URL with http:// or https://, this cause a malformed URL. Let's fix it.
     if (!preg_match('#^https?://#', $url)) {
         $url = 'http://' . $url;
     }
     // end if
     $name = sql_real_escape_string($name);
     $realname = sql_real_escape_string($realname);
     $password = sql_real_escape_string(md5($password));
     $email = sql_real_escape_string($email);
     $url = sql_real_escape_string($url);
     $admin = intval($admin);
     $canlogin = intval($canlogin);
     $notes = sql_real_escape_string($notes);
     if ($admin && !$canlogin) {
         return _ERROR;
     }
     $query = 'INSERT INTO ' . sql_table('member') . " (MNAME,MREALNAME,MPASSWORD,MEMAIL,MURL, MADMIN, MCANLOGIN, MNOTES) " . "VALUES ('{$name}','{$realname}','{$password}','{$email}','{$url}',{$admin}, {$canlogin}, '{$notes}')";
     sql_query($query);
     ACTIONLOG::add(INFO, _ACTIONLOG_NEWMEMBER . ' ' . $name);
     return 1;
 }
开发者ID:hatone,项目名称:Nucleus-v3.64,代码行数:45,代码来源:MEMBER.php

示例3: forgotPassword

 /**
  *  Sends a new password
  */
 function forgotPassword()
 {
     $membername = trim(postVar('name'));
     if (!MEMBER::exists($membername)) {
         doError(_ERROR_NOSUCHMEMBER);
     }
     $mem = MEMBER::createFromName($membername);
     /* below keeps regular users from resetting passwords using forgot password feature
     		 Removing for now until clear why it is required.*/
     /*if (!$mem->canLogin())
     		doError(_ERROR_NOLOGON_NOACTIVATE);*/
     // check if e-mail address is correct
     if (!($mem->getEmail() == postVar('email'))) {
         doError(_ERROR_INCORRECTEMAIL);
     }
     // send activation link
     $mem->sendActivationLink('forgot');
     if (postVar('url')) {
         redirect(postVar('url'));
     } else {
         //			header ("Content-Type: text/html; charset="._CHARSET);
         sendContentType('text/html', '', _CHARSET);
         echo _MSG_ACTIVATION_SENT;
         echo '<br /><br />Return to <a href="' . $CONF['IndexURL'] . '" title="' . $CONF['SiteName'] . '">' . $CONF['SiteName'] . '</a>';
     }
     exit;
 }
开发者ID:hatone,项目名称:Nucleus-v3.64,代码行数:30,代码来源:ACTION.php


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