How secure are PHP sessions?

前端 未结 6 631
抹茶落季
抹茶落季 2020-12-12 17:30

I\'m primarily a C++ programmer, but I\'m trying to pick up some PHP.

Apparently the way to implement web user sessions is to store the user\'s login ID in a cookie

6条回答
  •  無奈伤痛
    2020-12-12 17:49

    Answering this question needs 2 approaches:

    1. PHP session IDs are hard enough to guess for most use cases. Not much harder or less hard than other widely used systems.

    2. Trusting only a session cookie (and only the existance of a session cookie) seems not to go very far security-wise to me, no matter where this session cookie comes from - PHP or elsewhere.

    So, in short: PHP sessions are as secure, as your use of them makes them be. This is true for any session-cookie-based system I know of.

提交回复
热议问题