我将如何在两个数据库中执行ajax验证?一个是API数据库,另一个是本地数据库

时间:2012-10-27 04:34:17

标签: ajax codeigniter

我在我的控制器功能中有一个典型的用户名和密码输入表格

public function login() {
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    //if user dont exist in the in the local database it will be validated thru the API
    if(!$this->is_registered_email($_POST['username'])) {
        $ret = file_get_contents('http://www.XXXXd48170846c1e937640ae7e9f6743089c3c2a9074/auth/{"user":"' . $username . '","pass":"' . $password . '"}');
        $ret = json_decode($ret);
    } else {
        //this is where if the user exist in the local database and in the API database
        // and if the user input a wrong password

    }
    //this will return user details from the API if the user exists
    $data = array('response' => $ret);

}

我将评论添加到流程

0 个答案:

没有答案