CLASS_SSO::sso_login PHP Method

sso_login() public method

登录 sso_login function.
public sso_login ( $str_user, mixed $str_userPass, $str_userBy = "user_name" ) : 解码后数组
$str_userPass mixed 密码
return 解码后数组 登录结果
    function sso_login($str_user, $str_userPass, $str_userBy = "user_name")
    {
        $_arr_sso = array("act_post" => "login", $str_userBy => $str_user, "user_pass" => md5($str_userPass));
        $_arr_ssoData = array_merge($this->arr_data, $_arr_sso);
        $_arr_ssoData["signature"] = $this->sso_signature($_arr_ssoData);
        $_arr_get = fn_http(BG_SSO_URL . "?mod=user", $_arr_ssoData, "post");
        //提交
        $_arr_result = $this->result_process($_arr_get);
        if ($_arr_result["alert"] != "y010401") {
            return $_arr_result;
            //返回错误信息
        }
        $_arr_decode = $this->sso_decode($_arr_result["code"]);
        //解码
        $_arr_decode["alert"] = $_arr_result["alert"];
        return $_arr_decode;
    }

Usage Example

Example #1
0
<?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>