donmqryh49993 2013-07-30 03:00
浏览 107
已采纳

修改Cookie的值[重复]

This question already has an answer here:

I'm trying to set a secure session for a login interface and I'm checking if some hashed value saved on the $_COOKIE and in $_SESSION matches in both arrays. I need to change the value of the cookie via javascript to simulate an attack and check if my secure session works (if that is even possible, of course). Deleting the cookie wont work because I have a different validation for when the cookies doesnt exist.

Is it possible to modify a cookie's value via javascript and if so, how to?

</div>
  • 写回答

2条回答 默认 最新

  • duanao4503 2013-07-30 03:06
    关注

    Is it possible to modify a cookie's value via javascript and if so, how to?

    Yes. Provided it lives under the same domain and path, you can ready, modify, create, or destroy cookies either by JavaScript (document.cookie) or PHP ($_COOKIE and set_cookie()).

    As noted, you could also manipulate cookies via the developer tools of most modern browsers.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码