本文整理汇总了PHP中UserDao::getByPhone方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDao::getByPhone方法的具体用法?PHP UserDao::getByPhone怎么用?PHP UserDao::getByPhone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDao
的用法示例。
在下文中一共展示了UserDao::getByPhone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkphone
public function checkphone()
{
$phone = $_POST['phone'];
$UserDao = new UserDao();
$user = $UserDao->getByPhone($phone);
if ($user) {
echo "{\"msg\":\"no\"}";
} else {
echo "{\"msg\":\"ok\"}";
}
}
示例2: error
<?php
include_once 'SessionController.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/common/common_tools.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/UserDao.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/vo/UserInSession.php';
$phone = $_POST['cellphone_number'];
$pwd = $_POST['password'];
$base_url = getBaseUrl();
$userDao = new UserDao();
$sessionController = new SessionController();
$user_row = $userDao->getByPhone($phone);
if (empty($user_row)) {
// phone number doesn't exist.
error('此手机号没有注册过!');
} else {
if ($user_row['pwd'] != md5($pwd)) {
// incorrect password
error('用户名或密码错误!');
} else {
// login successfully
// tip: "double quetos" is a necessity for json format, json数据必须使用双引号
$userInSession = new UserInSession($user_row['id'], $user_row['name'], UserDao::TYPE_PHONE, null, null);
$sessionController->addUserJson(json_encode($userInSession));
echo "{\"msg\":\"success\"}";
}
}
function error($info)
{
echo $info;
}
示例3: UserDao
<?php
include_once 'SessionController.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/services/SmsSender.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/UserDao.php';
?>
<?php
$userDao = new UserDao();
$sessionController = new SessionController();
// Check time interval 后台检查时间间隔
$phone = $_GET['cellphone_number'];
$user = $userDao->getByPhone($phone);
if ($user) {
echo "手机号已被注册";
return;
}
if ($phone) {
// put cellphone number into session, in case user use an different number to register.
$sessionController->addCellphone($phone);
}
$last_time = $sessionController->getVerifyTime();
if (!empty($last_time)) {
$this_time = time();
$interval = $this_time - $last_time;
if ($interval < 120) {
echo "时间间隔太短!";
return;
}
}
$user = $userDao->getByPhone($phone);