本文整理匯總了PHP中UserData::getByEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserData::getByEmail方法的具體用法?PHP UserData::getByEmail怎麽用?PHP UserData::getByEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserData
的用法示例。
在下文中一共展示了UserData::getByEmail方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: infoAction
/**
* 我的信息
*/
public function infoAction()
{
$currUser = $this->refreshCurrentUser();
//$currUser = $this->getCurrentUser ();
if (ComTool::isAjax()) {
if (isset($_POST['captcha'])) {
$captcha = trim($this->post('captcha'));
if (!ComTool::checkCaptcha($captcha)) {
ComTool::ajax(100001, '驗證碼錯誤');
}
}
$email = trim($this->post('email', ''));
ComTool::checkEmpty($email, '請填寫常用郵箱');
ComTool::checkMaxLen($email, 32, '郵箱最多32位');
if (!ComTool::isEmail($email)) {
ComTool::ajax(100001, '請填寫正確的郵箱');
}
//檢查郵箱唯一性
$user = UserData::getByEmail($email);
if ($user && $user['id'] != $currUser['id']) {
ComTool::ajax(100001, '郵箱已被占用');
}
$mobile = trim($this->post('mobile', ''));
//ComTool::checkEmpty ( $mobile, '請填寫常用手機號' );
if ($mobile && !ComTool::isMobile($mobile)) {
ComTool::ajax(100001, '請填寫正確的手機號');
}
//檢查手機號唯一性
if ($mobile) {
$user = UserData::getByMobile($mobile);
if ($user && $user['id'] != $currUser['id']) {
ComTool::ajax(100001, '手機號已被占用');
}
}
$name = trim($this->post('name'));
ComTool::checkMaxLen($name, 16, "名稱最多16位");
$res = UserData::modify($currUser['id'], array('name' => $name, 'email' => $email, 'mobile' => $mobile, 'update_time' => time()));
ComTool::result($res, '服務器忙,請重試', '保存成功');
}
$this->assign("currUser", $currUser);
$this->display();
}
示例2: strlen
<?php
/**
* @author evilnapsis
* @brief Proceso de registo, obtiene los valores post del formulario de registro y los guarda en la bd.
**/
if (!empty($_POST)) {
if ($_POST["name"] != "" && $_POST["lastname"] != "" && $_POST["email"] != "" && $_POST["password"] != "") {
$user = UserData::getByEmail($_POST["email"]);
if ($user == null) {
$str = "abcdefghijklmopqrstuvwxyz1234567890";
$code = "";
for ($i = 0; $i < 6; $i++) {
$code .= $str[rand(0, strlen($str) - 1)];
}
$user = new UserData();
$user->name = $_POST["name"];
$user->lastname = $_POST["lastname"];
$user->email = $_POST["email"];
$user->password = sha1(md5($_POST["password"]));
$user->code = $code;
$u = $user->add();
$p = new ProfileData();
$p->user_id = $u[1];
$p->add();
$msg = "<body><h1>Registro Exitoso</h1>\r\n\t\t\t\t\t<p>Ahora debes activar tu cuenta en el siguiente link:</p>\r\n\t\t\t\t\t<p><a href='http://youhost/app/index.php?r=index/processactivation&e=" . sha1(md5($_POST["email"])) . "&c=" . sha1(md5($code)) . "'>Activa tu cuenta:</a></p>\r\n\t\t\t\t\t<p>O tambien puedes usar el siguiente codigo de activacion: " . $code . "</p>\r\n\t\t\t\t\t</body>";
mail($_POST["email"], "Registro Exitoso", $msg);
/* $f = fopen (ROOT."/register.txt","w");
fwrite($f, $msg);
fclose($f);
*/
示例3: sregAction
/**
* 小店注冊
*/
public function sregAction()
{
//注冊時必填郵箱和手機
if (ComTool::isAjax()) {
if (isset($_POST['captcha'])) {
$captcha = trim($this->post('captcha'));
if (!ComTool::checkCaptcha($captcha)) {
ComTool::ajax(100001, '驗證碼錯誤');
}
}
$email = trim($this->post('email'));
ComTool::checkEmpty($email, '請填寫常用郵箱');
ComTool::checkMaxLen($email, 32, '郵箱最多32位');
if (!ComTool::isEmail($email)) {
ComTool::ajax(100001, '請填寫正確的郵箱');
}
//檢查郵箱唯一性
$user = UserData::getByEmail($email);
if ($user) {
ComTool::ajax(100001, '郵箱已被注冊');
}
$mobile = '';
$mobile = trim($this->post('mobile'));
ComTool::checkEmpty($mobile, '請填寫常用手機號');
if (!ComTool::isMobile($mobile)) {
ComTool::ajax(100001, '請填寫正確的手機號');
}
//檢查手機唯一性
$user = UserData::getByMobile($mobile);
if ($user) {
ComTool::ajax(100001, '手機號已被注冊');
}
$city = trim($this->post('city'));
ComTool::checkEmpty($city, '請選擇城市');
$area = trim($this->post('area'));
ComTool::checkEmpty($area, '請選擇區域');
$group = trim($this->post('group'));
ComTool::checkEmpty($group, '請選擇圈子');
$addr_desc = trim($this->post('addr_desc'));
ComTool::checkEmpty($addr_desc, '請填寫詳細位置');
ComTool::checkMaxLen($addr_desc, 32, '詳細位置最多32位');
$passwd = trim($this->post('passwd'));
ComTool::checkEmpty($passwd, '請輸入密碼');
ComTool::checkMinMaxLen($passwd, 6, 16, '密碼6-16位');
$cpasswd = trim($this->post('cpasswd'));
ComTool::checkEqual($passwd, $cpasswd, '兩次輸入的密碼不同');
$res = UserData::add(array('email' => $email, 'mobile' => $mobile, 'passwd' => md5($passwd), 'create_time' => time(), 'update_time' => time(), 'status' => 1));
/* if ($res === false) {
ComTool::ajax ( 100001, '服務器忙,請重試' );
}
$res = UserGroupData::add ( array (
'user_id' => $res,
'group_id' => $group,
'detail' => $addr_desc,
'status' => 1
) ); */
ComTool::result($res, '服務器忙,請重試', '注冊成功,即將跳轉');
}
$this->display();
}