xss攻击两种 reflected 和storedphp
如xss能够获取用户的cookie html
<script>alert(document.cookie)</script>
csrf能够跨站请求修改删除用户信息安全
防护措施:cookie
1.通常的XSS脚本
xss
2.安全函数 如php的 htmlspecialchars stripslashes
函数
htmlspecialchars 转义&,‘,",<,>
code
CSRF防护
csrf
1.referer验证,但不可靠能够伪造
htm
2.设置token
token
$csrf = md5(uniqid(rand(), TRUE));
$_SESSION['csrf'] = $csrf;//防刷机制第二弹~~~~~~~~