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


PHP Func::IsEmailAddress方法代码示例

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


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

示例1: write

 function write()
 {
     if (bff::$isAjax) {
         $nUserID = $this->security->getUserID();
         $p = $this->input->postm(array('email' => TYPE_STR, 'phone' => TYPE_NOHTML, 'message' => TYPE_NOHTML, 'captcha' => TYPE_STR));
         if (!$nUserID) {
             if (empty($p['email']) || !Func::IsEmailAddress($p['email'])) {
                 $this->errors->set('wrong_email');
             }
         }
         $p['phone'] = func::cleanComment($p['phone']);
         if (empty($p['phone'])) {
             $this->errors->set('no_phone');
         }
         $p['message'] = func::cleanComment($p['message']);
         if (empty($p['message'])) {
             $this->errors->set('no_message');
         }
         if (!$nUserID) {
             $oProtection = new CCaptchaProtection();
             if (!$oProtection->valid(isset($_SESSION['c2']) ? $_SESSION['c2'] : '', $p['captcha'])) {
                 $this->errors->set('wrong_captcha');
             }
         }
         if ($this->errors->no()) {
             unset($_SESSION['c2']);
             $this->db->execute('INSERT INTO ' . TABLE_CONTACTS . ' (user_id, email, phone, message, created) 
                            VALUES (' . $nUserID . ', ' . $this->db->str2sql($p['email']) . ', 
                                    ' . $this->db->str2sql($p['phone']) . ', ' . $this->db->str2sql(nl2br($p['message'])) . ', 
                                    ' . $this->db->getNOW() . ')');
             $nRecordID = $this->db->insert_id(TABLE_CONTACTS, 'id');
             if ($nRecordID) {
                 config::saveCount('contacts_new', 1);
                 bff::sendMailTemplate(array('user' => !$nUserID ? 'Аноним' : $this->security->getUserEmail(), 'email' => !$nUserID ? $p['email'] : $this->security->getUserEmail(), 'phone' => $p['phone'], 'message' => nl2br($p['message'])), 'admin_contacts', config::get('mail_admin', BFF_EMAIL_SUPPORT));
             }
         }
         $this->ajaxResponse(Errors::SUCCESS);
     }
     config::set('title', 'Связь с редактором - ' . config::get('title', ''));
     return $this->tplFetch('write.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:41,代码来源:contacts.class.php

示例2: mod_add

 function mod_add()
 {
     if (!$this->haveAccessTo('users-edit')) {
         return $this->showAccessDenied();
     }
     $this->input->postm(array('login' => TYPE_STR, 'avatar' => TYPE_STR, 'name' => TYPE_STR, 'email' => TYPE_STR, 'password' => TYPE_STR, 'password2' => TYPE_STR, 'balance' => TYPE_NUM, 'skype' => TYPE_STR, 'email2' => TYPE_STR, 'phone' => TYPE_STR, 'group_id' => TYPE_ARRAY_INT, 'cat' => TYPE_ARRAY_UINT), $aData);
     $aData['admin'] = 0;
     if (bff::$isPost) {
         do {
             //                if($aData['city_id']<=0) {
             //                    $this->errors->set('wrong:city'); break;
             //                }
             $aData['email_hash'] = func::getEmailHash($aData['email']);
             if (!$aData['login']) {
                 $this->errors->set('empty:login');
                 break;
             }
             if (!$aData['email']) {
                 $this->errors->set('empty:email');
                 break;
             } elseif (!Func::IsEmailAddress($aData['email'])) {
                 $this->errors->set('wrong:email');
                 break;
             }
             if ($this->isLoginExists($aData['login'])) {
                 $this->errors->set('login_exist');
                 break;
             }
             if ($this->isEmailExists($aData['email_hash'])) {
                 $this->errors->set('email_exist');
                 break;
             }
             if (!$aData['password']) {
                 $this->errors->set('empty:password');
                 break;
             } elseif ($aData['password'] != $aData['password2']) {
                 $this->errors->set('password_confirmation');
                 break;
             }
             if ($this->errors->no()) {
                 $aGroupID = $aData['group_id'];
                 //array
                 $aData['member'] = 0;
                 $aData['ip_reg'] = func::getRemoteAddress(true);
                 $aData['activated'] = 1;
                 $aData['cat'] = join(',', $aData['cat']);
                 unset($aData['password2'], $aData['group_id']);
                 $nRecordID = $this->userInsert($aData);
                 if ($nRecordID > 0) {
                     $avatar = new CAvatar(TABLE_USERS, USERS_AVATAR_PATH, 'avatar', 'user_id');
                     $avatar->update($nRecordID, false, true);
                     if (empty($aGroupID)) {
                         $aGroupID = array(USERS_GROUPS_MEMBER);
                     } else {
                         $this->assignUser2Groups($nRecordID, $aGroupID);
                     }
                     # обновляем, является ли юзер администратором
                     $bIsAdmin = 0;
                     if (!(count($aGroupID) == 1 && current($aGroupID) == self::GROUPID_MEMBER)) {
                         if (in_array(self::GROUPID_SUPERADMIN, $aGroupID) || in_array(self::GROUPID_MODERATOR, $aGroupID)) {
                             $bIsAdmin = 1;
                         } else {
                             $aUserGroups = $this->getGroups(null, $aGroupID);
                             foreach ($aUserGroups as $v) {
                                 if ($v['adminpanel'] == 1) {
                                     $bIsAdmin = 1;
                                     break;
                                 }
                             }
                         }
                         if ($bIsAdmin) {
                             $this->db->execute('UPDATE ' . TABLE_USERS . ' SET admin=' . $bIsAdmin . ' WHERE user_id=' . $nRecordID);
                         }
                     }
                 }
                 $this->adminRedirect(Errors::SUCCESSFULL, (!$aData['member'] ? 'admin_' : '') . 'listing');
             }
         } while (false);
         $this->input->postm(array('password2' => TYPE_STR, 'group_id' => TYPE_ARRAY_INT), $aData);
         func::array_2_htmlspecialchars($aData, null, true);
         $aActiveGroupsID = $aData['group_id'];
     } else {
         $aActiveGroupsID = array();
     }
     $aData = array_merge($aData, array('password2' => '', 'user_id' => ''));
     //assign groups
     $exists_options = '';
     $active_options = '';
     $aGroups = $this->getGroups(array(USERS_GROUPS_MEMBER, USERS_GROUPS_SUPERADMIN));
     for ($i = 0; $i < count($aGroups); $i++) {
         if (in_array($aGroups[$i]['group_id'], $aActiveGroupsID)) {
             $active_options .= '<option value="' . $aGroups[$i]['group_id'] . '" style="color:' . $aGroups[$i]['color'] . ';">' . $aGroups[$i]['title'] . '</option>';
         } else {
             $exists_options .= '<option value="' . $aGroups[$i]['group_id'] . '" style="color:' . $aGroups[$i]['color'] . ';">' . $aGroups[$i]['title'] . '</option>';
         }
     }
     $this->tplAssign('exists_options', $exists_options);
     $this->tplAssign('active_options', $active_options);
     //$aData['city_options'] = bff::i()->Sites_geoCityOptions($aData['city_id'], 'edit');
     $aData['edit'] = false;
//.........这里部分代码省略.........
开发者ID:Sywooch,项目名称:dobox,代码行数:101,代码来源:users.adm.class.php


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