function ajax_chkauth() { $this->check_db(); include_once BG_PATH_MODEL . "admin.class.php"; //载入管理帐号模型 $_mdl_admin = new MODEL_ADMIN(); //设置管理组模型 $_obj_sso = new CLASS_SSO(); $_str_adminName = fn_getSafe(fn_get("admin_name"), "txt", ""); $_arr_ssoGet = $_obj_sso->sso_get($_str_adminName, "user_name"); if ($_arr_ssoGet["alert"] == "y010102") { //检验用户是否存在 $_arr_adminRow = $_mdl_admin->mdl_read($_arr_ssoGet["user_id"]); if ($_arr_adminRow["alert"] == "y020102") { $this->obj_ajax->halt_re("x020214"); } } else { if ($_arr_ssoGet["alert"] == "x010102") { $this->obj_ajax->halt_re("x020205"); } else { $this->obj_ajax->halt_re($_arr_ssoGet["alert"]); } } $arr_re = array("re" => "ok"); exit(json_encode($arr_re)); }
<?php define(BG_SSO_URL, "http://www.domain.com/api/api.php"); //SSO 地址 define(BG_SSO_APPID, 1); //APP ID define(BG_SSO_APPKEY, ""); //APP KEY include_once "func.php"; include_once "notify.class.php"; include_once "sso.class.php"; include_once "sync.class.php"; $obj_sso = new CLASS_SSO(); $str_userName = fn_post("user_name"); $str_userPass = fn_post("user_pass"); $arr_userSso = $obj_sso->sso_login($str_userName, $str_userPass); //调用登录方法 /* 开始会话等操作 */ $sync = $obj_sso->sso_sync_login(); //调用同步方法 ?> <!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8"> <title>login</title> <!--jQuery 库--> <script src="jquery.min.js" type="text/javascript"></script>