本文整理汇总了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();
}