header('Content-Type:text/html; charset=utf-8');
$sso_address = 'http://XXXX.com/sso/login.php'; //你SSO所在的域名
$callback_address = 'http://'.$_SERVER['HTTP_HOST']
.str_replace('index.php','',$_SERVER['SCRIPT_NAME'])
.'callback.php'; //callback地址用于回调设置cookie
if(isset($_COOKIE['sign'])){
exit("欢迎您{$_COOKIE['sign']}
退出");
}else{
echo '您还未登录
点此登录';
}
?>
header('Content-Type:text/html; charset=utf-8');
if(isset($_GET['logout'])){
setcookie('sign','',-300);
unset($_GET['logout']);
header('location:index.php');
}
if(isset($_POST['username']) && isset($_POST['password'])){
setcookie('sign',$_POST['username'],0,'');
header("location:".$_POST['callback']."?sign={$_POST['username']}");
}
if(emptyempty($_COOKIE['sign'])){
?>
}else{
$query = http_build_query($_COOKIE);
echo "系统检测到您已登录 {$_COOKIE['sign']}
授权 退出";
}
?>