本文整理匯總了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);