当前位置: 首页>>代码示例>>PHP>>正文


PHP UserDao::getByPhone方法代码示例

本文整理汇总了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\"}";
     }
 }
开发者ID:dreamingodd,项目名称:casarover,代码行数:11,代码来源:UserController.php

示例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;
}
开发者ID:dreamingodd,项目名称:casarover,代码行数:31,代码来源:login_phone_action.php

示例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);
开发者ID:dreamingodd,项目名称:casarover,代码行数:31,代码来源:send_verify_action.php


注:本文中的UserDao::getByPhone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。