本文整理匯總了PHP中UserData::getByMobile方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserData::getByMobile方法的具體用法?PHP UserData::getByMobile怎麽用?PHP UserData::getByMobile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserData
的用法示例。
在下文中一共展示了UserData::getByMobile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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();
}