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


PHP BuckysUser::checkEmailDuplication方法代码示例

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


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

示例1: createNewAccount

 /**
  * Create New Account
  * 
  * @param Array $data
  */
 public function createNewAccount($data)
 {
     global $db;
     $data = array_map('trim', $data);
     if ($data['firstName'] == '' || $data['lastName'] == '') {
         buckys_add_message(MSG_USERNAME_EMPTY_ERROR, MSG_TYPE_ERROR);
         return false;
     }
     //Check Email Address
     if (!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\\._-]+)+\$/", $data['email'])) {
         buckys_add_message(MSG_INVALID_EMAIL, MSG_TYPE_ERROR);
         return false;
     }
     //Check Email Duplication
     if (BuckysUser::checkEmailDuplication($data['email'])) {
         buckys_add_message(MSG_EMAIL_EXIST, MSG_TYPE_ERROR);
         return false;
     }
     if (!$data['password'] || !$data['password2']) {
         buckys_add_message(MSG_EMPTY_PASSWORD, MSG_TYPE_ERROR);
         return false;
     }
     if ($data['password'] != $data['password2']) {
         buckys_add_message(MSG_NOT_MATCH_PASSWORD, MSG_TYPE_ERROR);
         return false;
     }
     //Create Token
     $token = md5(mt_rand(0, 99999) . time() . $data['email'] . mt_rand(0, 99999));
     $password = buckys_encrypt_password($data['password']);
     //Create New Account
     $newId = $db->insertFromArray(TABLE_USERS, array('firstName' => $data['firstName'], 'lastName' => $data['lastName'], 'email' => $data['email'], 'email_visibility' => 0, 'password' => $password, 'thumbnail' => '', 'user_type' => 'Registered', 'user_acl_id' => 2, 'token' => $token));
     if (!$newId) {
         buckys_add_message($db->getLastError(), MSG_TYPE_ERROR);
         return false;
     }
     //Send an email to new user with a validation link
     $link = "http://" . $_SERVER['HTTP_HOST'] . "/register.php?action=verify&email=" . $data['email'] . "&token=" . $token;
     $title = "Please verify your account.";
     $body = "Dear " . $data['firstName'] . " " . $data['lastName'] . "\n\n" . "Thanks for your registration. \n" . "To complete your registration, please verify your email address by clicking the below link:. \n" . $link . "\n\nBuckysroom.com";
     buckys_sendmail($data['email'], $data['firstName'] . " " . $data['lastName'], $title, $body);
     return $newId;
 }
开发者ID:kishoreks,项目名称:BuckysRoom,代码行数:47,代码来源:class.BuckysUser.php

示例2: createNewAccount

 /**
  * Create New Account
  *
  * @param Array $data
  * @return bool|int|null|string
  */
 public static function createNewAccount($data)
 {
     global $db;
     $data = array_map('trim', $data);
     if ($data['firstName'] == '' || $data['lastName'] == '') {
         buckys_add_message(MSG_USERNAME_EMPTY_ERROR, MSG_TYPE_ERROR);
         return false;
     }
     //Check Email Address
     if (!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\\._-]+)+\$/", $data['email'])) {
         buckys_add_message(MSG_INVALID_EMAIL, MSG_TYPE_ERROR);
         return false;
     }
     //Check Email Duplication
     if (BuckysUser::checkEmailDuplication($data['email'])) {
         //If this one is banned?
         if (BuckysUser::getUserStatus($data['email']) == BuckysUser::STATUS_USER_DELETED) {
             buckys_add_message(MSG_EMAIL_BANNED, MSG_TYPE_ERROR);
         } else {
             buckys_add_message(MSG_EMAIL_EXIST, MSG_TYPE_ERROR);
         }
         return false;
     }
     if (!$data['password'] || !$data['password2']) {
         buckys_add_message(MSG_EMPTY_PASSWORD, MSG_TYPE_ERROR);
         return false;
     }
     if ($data['password'] != $data['password2']) {
         buckys_add_message(MSG_NOT_MATCH_PASSWORD, MSG_TYPE_ERROR);
         return false;
     }
     if (!buckys_check_password_strength($data['password'])) {
         buckys_add_message(MSG_PASSWORD_STRENGTH_ERROR, MSG_TYPE_ERROR);
         return false;
     }
     //Create Token
     $token = md5(mt_rand(0, 99999) . time() . $data['email'] . mt_rand(0, 99999));
     $password = buckys_encrypt_password($data['password']);
     //Create New Account
     $newId = $db->insertFromArray(TABLE_USERS, ['firstName' => $data['firstName'], 'lastName' => $data['lastName'], 'email' => $data['email'], 'email_visibility' => -1, 'password' => $password, 'thumbnail' => '', 'user_type' => 'Registered', 'user_acl_id' => 2, 'ip_addr' => $_SERVER['REMOTE_ADDR'], 'created_date' => date('Y-m-d H:i:s'), 'token' => $token]);
     if (!$newId) {
         buckys_add_message($db->getLastError(), MSG_TYPE_ERROR);
         return false;
     }
     //Create New Record on the users_stats table
     $db->insertFromArray(TABLE_USERS_STATS, ['userID' => $newId, 'pageFollowers' => 0, 'likes' => 0, 'comments' => 0, 'voteUps' => 0, 'replies' => 0, 'reputation' => 0]);
     //Make new user to follow all categories
     BuckysForumFollower::followBasicForums($newId);
     $url_protocol = "http://";
     if (SITE_USING_SSL == true) {
         $url_protocol = "https://";
     }
     //Send an email to new user with a validation link
     $link = $url_protocol . $_SERVER['HTTP_HOST'] . "/register.php?action=verify&email=" . $data['email'] . "&token=" . $token;
     $title = "Please verify your account.";
     $body = "Dear " . $data['firstName'] . " " . $data['lastName'] . "\n\n" . "Thanks for your registration. \n" . "To complete your registration, please verify your email address by clicking the below link:. \n" . $link . "\n\n" . TNB_DOMAIN;
     buckys_sendmail($data['email'], $data['firstName'] . " " . $data['lastName'], $title, $body);
     return $newId;
 }
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:65,代码来源:class.BuckysUser.php


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