You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
901 B
36 lines
901 B
<?php |
|
/** |
|
* 解密并返回同步的用户信息 |
|
* 2020.02 by xiaowei |
|
*/ |
|
class idapi_getuser{ |
|
|
|
public function aes_decrypt($enc){ |
|
$raw = hex2bin($enc); |
|
$cipherMethod = 'aes-128-ctr'; |
|
$ivlen = openssl_cipher_iv_length($cipherMethod); |
|
$iv = substr($raw, 0, $ivlen); |
|
$raw = substr($raw, $ivlen); |
|
$res = openssl_decrypt($raw, $cipherMethod, API_KEY, OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING, $iv); |
|
return $res; |
|
} |
|
|
|
public function getAuth(){ |
|
if(!$_COOKIE["fr_id_auth"]){return false;} |
|
$ck_auth = $this->aes_decrypt($_COOKIE["fr_id_auth"]); |
|
$jsonarr = json_decode($ck_auth,true); |
|
return $jsonarr; |
|
} |
|
|
|
public function getUserinfo(){ |
|
if($_COOKIE['fr_id_auth']){ |
|
if(!$_COOKIE["fr_id_userinfo"]){return false;} |
|
$ck_auth = $this->aes_decrypt($_COOKIE["fr_id_userinfo"]); |
|
$jsonarr = json_decode($ck_auth,true); |
|
return $jsonarr; |
|
}else{ |
|
return false; |
|
} |
|
} |
|
|
|
} |