Files
BlueLotus_XSSReceiver/auth.php
firesun 4534a9b567 Version 2.3
实现keepsession
修复新消息时标题的bug
2015-10-31 13:46:47 +08:00

27 lines
1.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
if(!defined('IN_XSS_PLATFORM')) {
exit('Access Denied');
}
//设置httponly
ini_set("session.cookie_httponly", 1);
session_start();
//判断登陆情况ip和useragent是否改变改变则强制退出
if(!(isset($_SESSION['isLogin']) && $_SESSION['isLogin']===true && isset($_SESSION['user_IP']) &&$_SESSION['user_IP']!="" &&$_SESSION['user_IP']=== $_SERVER['REMOTE_ADDR'] &&isset($_SESSION['user_agent']) &&$_SESSION['user_agent']!="" &&$_SESSION['user_agent']=== $_SERVER['HTTP_USER_AGENT'] ))
{
$_SESSION['isLogin']=false;
$_SESSION['user_IP']="";
$_SESSION['user_agent']="";
session_unset();
session_destroy();
header("Location: login.php");
exit();
}
//开启CSP
header("Content-Security-Policy: default-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; frame-src 'none'");
header("X-Content-Security-Policy: default-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; frame-src 'none'");
header("X-WebKit-CSP: default-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; frame-src 'none'");
?>