如何在两个数据库中执行ajax验证?一个是API数据库,另一个是本地数据库
在我的视图中,我的控制器函数中有一个典型的用户名和密码输入表单如何在两个数据库中执行ajax验证?一个是API数据库,另一个是本地数据库,ajax,codeigniter,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_regist
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);
}
我在流程中添加了注释为什么在javascript验证服务器端进行中继。因为页面不应该使用ajax重新加载,但我说的是验证服务器端。我认为服务器端验证是您应该做的